// Path: sqliteDBViewModelDemo/app/src/main/java/edu/cs4730/sqlitedbviewmodeldemo/db/CursorViewModel.java
// public class CursorViewModel extends AndroidViewModel {
//     ScoreDatabase db;
//     MutableLiveData<Cursor> myCursor = new MutableLiveData<Cursor>();
// 
//     public CursorViewModel(@NonNull Application application) {
//         super(application);
//         db = new ScoreDatabase(application);
//         db.open();
//         myCursor.setValue(db.getAllNames());
//         db.close();
//     }
// 
//     public MutableLiveData<Cursor> getData() {
//         return myCursor;
//     }
// 
//     // this uses the Convenience method to add something to the database and then update the cursor.
//     public void add(String name, int value) {
//         db.open();
//         db.insertName(name, value);
//         myCursor.setValue(db.getAllNames());
//         db.close();
//     }
// 
//     // this uses the Convenience method to update something from the database and then update the cursor.
//     public int Update(String TableName, ContentValues values, String selection, String[] selectionArgs) {
//         db.open();
//         int ret = db.Update(TableName, values, selection, selectionArgs);
//         myCursor.setValue(db.getAllNames());
//         db.close();
//         return ret;
//     }
// 
//     // this uses the Convenience method to delete something in the database and then update the cursor.
//     public int Delete(String TableName, String selection, String[] selectionArgs) {
//         db.open();
//         int ret = db.Delete(TableName, selection, selectionArgs);
//         myCursor.setValue(db.getAllNames());
//         db.close();
//         return ret;
//     }
// 
// }


import androidx.appcompat.app.AppCompatActivity;
import androidx.lifecycle.Observer;
import androidx.lifecycle.ViewModelProvider;
import androidx.recyclerview.widget.DefaultItemAnimator;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import edu.cs4730.sqlitedbviewmodeldemo.db.CursorViewModel;
import android.database.Cursor;
import android.os.Bundle;
import android.view.View;
import com.google.android.material.floatingactionbutton.FloatingActionButton;
package edu.cs4730.sqlitedbviewmodeldemo;




public class MainActivity extends AppCompatActivity {
    RecyclerView mRecyclerView;
    FloatingActionButton fab;
    myAdapter mAdapter;

// Path: sqliteDBViewModelDemo/app/src/main/java/edu/cs4730/sqlitedbviewmodeldemo/db/CursorViewModel.java
// public class CursorViewModel extends AndroidViewModel {
//     ScoreDatabase db;
//     MutableLiveData<Cursor> myCursor = new MutableLiveData<Cursor>();
// 
//     public CursorViewModel(@NonNull Application application) {
//         super(application);
//         db = new ScoreDatabase(application);
//         db.open();
//         myCursor.setValue(db.getAllNames());
//         db.close();
//     }
// 
//     public MutableLiveData<Cursor> getData() {
//         return myCursor;
//     }
// 
//     // this uses the Convenience method to add something to the database and then update the cursor.
//     public void add(String name, int value) {
//         db.open();
//         db.insertName(name, value);
//         myCursor.setValue(db.getAllNames());
//         db.close();
//     }
// 
//     // this uses the Convenience method to update something from the database and then update the cursor.
//     public int Update(String TableName, ContentValues values, String selection, String[] selectionArgs) {
//         db.open();
//         int ret = db.Update(TableName, values, selection, selectionArgs);
//         myCursor.setValue(db.getAllNames());
//         db.close();
//         return ret;
//     }
// 
//     // this uses the Convenience method to delete something in the database and then update the cursor.
//     public int Delete(String TableName, String selection, String[] selectionArgs) {
//         db.open();
//         int ret = db.Delete(TableName, selection, selectionArgs);
//         myCursor.setValue(db.getAllNames());
//         db.close();
//         return ret;
//     }
// 
// }


// Path: sqliteDBViewModelDemo/app/src/main/java/edu/cs4730/sqlitedbviewmodeldemo/MainActivity.java
import androidx.appcompat.app.AppCompatActivity;
import androidx.lifecycle.Observer;
import androidx.lifecycle.ViewModelProvider;
import androidx.recyclerview.widget.DefaultItemAnimator;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import edu.cs4730.sqlitedbviewmodeldemo.db.CursorViewModel;
import android.database.Cursor;
import android.os.Bundle;
import android.view.View;
import com.google.android.material.floatingactionbutton.FloatingActionButton;

package edu.cs4730.sqlitedbviewmodeldemo;




public class MainActivity extends AppCompatActivity {
    RecyclerView mRecyclerView;
    FloatingActionButton fab;
    myAdapter mAdapter;

    CursorViewModel mViewModel;