// Path: sqliteDemo/app/src/main/java/edu/cs4730/sqlitedemo/db/mySQLiteHelper.java
// public class mySQLiteHelper extends SupportSQLiteOpenHelper.Callback {
// 
//     private static final String TAG = "mySQLiteHelper";
// 
//     //column names for the table.
//     public static final String KEY_NAME = "Name";
//     public static final String KEY_SCORE = "Score";
//     public static final String KEY_ROWID = "_id";   //required field for the cursorAdapter
// 
//     public static final String DATABASE_NAME = "myScore.db";
//     public static final String TABLE_NAME = "HighScore";
//     private static final int DATABASE_VERSION = 2;
// 
//     // Database creation sql statement
//     private static final String DATABASE_CREATE =
//         "CREATE TABLE " + TABLE_NAME + " (" +
//             KEY_ROWID + " integer PRIMARY KEY autoincrement," +  //this line is required for the cursorAdapter.
//             KEY_NAME + " TEXT, " +
//             KEY_SCORE + " INTEGER );";
// 
//     //required constructor with the super.
//     public mySQLiteHelper() {
//         super(DATABASE_VERSION);
//     }
// 
//     @Override
//     public void onCreate(SupportSQLiteDatabase db) {
//         //NOTE only called when the database is initial created!
//         db.execSQL(DATABASE_CREATE);
//     }
// 
//     @Override
//     public void onUpgrade(SupportSQLiteDatabase db, int oldVersion, int newVersion) {
//         //Called when the database version changes, Remember the constant from above.
//         Log.w(TAG, "Upgrading database from version " + oldVersion
//             + " to "
//             + newVersion + ", which will destroy all old data");
//         db.execSQL("DROP TABLE IF EXISTS " + TABLE_NAME);
//         onCreate(db);
//     }
// 
// }


import android.database.Cursor;
import android.net.Uri;
import android.os.Bundle;
import androidx.fragment.app.Fragment;
import androidx.cursoradapter.widget.SimpleCursorAdapter;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.ListView;
import android.widget.Toast;
import android.widget.AdapterView.OnItemClickListener;
import edu.cs4730.sqlitedemo.db.mySQLiteHelper;
package edu.cs4730.sqlitedemo;



/**
 * This is a demo of how to use a content provider (which is in this code, myDBContenProvider is the provider)
 *  with a listview.   This is very similar to CursorAdapter_fragment,
  *
  *  See sqliteDemo3 for a recyclerview using a content provider.
 */

public class ContentProvider_Fragment  extends Fragment {


    String TAG = "ContentProvider_frag";
    Cursor cursor;
    private SimpleCursorAdapter dataAdapter;


    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        View myView = inflater.inflate(R.layout.contentprovider_fragment, container, false);

        //get the people URI
        Uri CONTENT_URI = Uri.parse("content://edu.cs4730.scoreprovider/score");
        //setup the information we want for the contentprovider.
// Path: sqliteDemo/app/src/main/java/edu/cs4730/sqlitedemo/db/mySQLiteHelper.java
// public class mySQLiteHelper extends SupportSQLiteOpenHelper.Callback {
// 
//     private static final String TAG = "mySQLiteHelper";
// 
//     //column names for the table.
//     public static final String KEY_NAME = "Name";
//     public static final String KEY_SCORE = "Score";
//     public static final String KEY_ROWID = "_id";   //required field for the cursorAdapter
// 
//     public static final String DATABASE_NAME = "myScore.db";
//     public static final String TABLE_NAME = "HighScore";
//     private static final int DATABASE_VERSION = 2;
// 
//     // Database creation sql statement
//     private static final String DATABASE_CREATE =
//         "CREATE TABLE " + TABLE_NAME + " (" +
//             KEY_ROWID + " integer PRIMARY KEY autoincrement," +  //this line is required for the cursorAdapter.
//             KEY_NAME + " TEXT, " +
//             KEY_SCORE + " INTEGER );";
// 
//     //required constructor with the super.
//     public mySQLiteHelper() {
//         super(DATABASE_VERSION);
//     }
// 
//     @Override
//     public void onCreate(SupportSQLiteDatabase db) {
//         //NOTE only called when the database is initial created!
//         db.execSQL(DATABASE_CREATE);
//     }
// 
//     @Override
//     public void onUpgrade(SupportSQLiteDatabase db, int oldVersion, int newVersion) {
//         //Called when the database version changes, Remember the constant from above.
//         Log.w(TAG, "Upgrading database from version " + oldVersion
//             + " to "
//             + newVersion + ", which will destroy all old data");
//         db.execSQL("DROP TABLE IF EXISTS " + TABLE_NAME);
//         onCreate(db);
//     }
// 
// }


// Path: sqliteDemo/app/src/main/java/edu/cs4730/sqlitedemo/ContentProvider_Fragment.java
import android.database.Cursor;
import android.net.Uri;
import android.os.Bundle;
import androidx.fragment.app.Fragment;
import androidx.cursoradapter.widget.SimpleCursorAdapter;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.ListView;
import android.widget.Toast;
import android.widget.AdapterView.OnItemClickListener;
import edu.cs4730.sqlitedemo.db.mySQLiteHelper;

package edu.cs4730.sqlitedemo;



/**
 * This is a demo of how to use a content provider (which is in this code, myDBContenProvider is the provider)
 *  with a listview.   This is very similar to CursorAdapter_fragment,
  *
  *  See sqliteDemo3 for a recyclerview using a content provider.
 */

public class ContentProvider_Fragment  extends Fragment {


    String TAG = "ContentProvider_frag";
    Cursor cursor;
    private SimpleCursorAdapter dataAdapter;


    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        View myView = inflater.inflate(R.layout.contentprovider_fragment, container, false);

        //get the people URI
        Uri CONTENT_URI = Uri.parse("content://edu.cs4730.scoreprovider/score");
        //setup the information we want for the contentprovider.
        String[] projection = new String[]{mySQLiteHelper.KEY_ROWID, mySQLiteHelper.KEY_NAME, mySQLiteHelper.KEY_SCORE};