I am looking for some assistance with SQLite database. I have tried several other scenarios to no
avail. I am looking to have a table in my activity_weight_table.xml, I'm thinking recyclerview
but not sure. Also, I would need help with my login and password checking it agaisnt a database
and having these screens work together. My database should be able to Create: The user should
be able to add items to a database. Delete: The user should be able to remove items from a
database. Update: The user should be able to change the value associated with individual
database items (e.g. the number of a specific item in an inventory or the date of an event). Read:
The user should be able to view all of the database items displayed as a grid. These are my
following Java codes: MainActivity.java package com.example.weight; import
android.content.Intent; import android.os.Bundle; import android.widget.Button; import
android.widget.EditText; import androidx.appcompat.app.AppCompatActivity; public class
MainActivity extends AppCompatActivity { Button button_login, createAccount; EditText
loginUserName, loginPassword; @Override protected void onCreate(Bundle
savedInstanceState) { super.onCreate(savedInstanceState);
setContentView(R.layout.activity_login_weight); button_login =
findViewById(R.id.button_login); loginPassword = findViewById(R.id.loginPassword);
loginUserName = findViewById(R.id.loginUserName); createAccount =
findViewById(R.id.createAccount); createAccount.setOnClickListener((view) -> {
Intent intent = new Intent(MainActivity.this, CreateAccountActivity.class);
startActivity(intent); }); button_login.setOnClickListener((view) -> { Intent
intent = new Intent(MainActivity.this, LoginActivity.class); startActivity(intent); });
} } DatabaseHelper.java package com.example.weight; import android.content.Context;
import android.database.sqlite.SQLiteDatabase; import
android.database.sqlite.SQLiteOpenHelper; public class DatabaseHelper extends
SQLiteOpenHelper { private static final String DATABASE_NAME = "UserAccounts.db";
private static final int DATABASE_VERSION = 1; public static final String
TABLE_USERS = "users"; public static final String COLUMN_ID = "id"; public static
final String COLUMN_USERNAME = "username"; public static final String
COLUMN_PASSWORD = "password"; private static final String TABLE_CREATE =
"CREATE TABLE " + TABLE_USERS + " (" + COLUMN_ID + " INTEGER
PRIMARY KEY AUTOINCREMENT, " + COLUMN_USERNAME + " TEXT, "
+ COLUMN_PASSWORD + " TEXT)"; public DatabaseHelper(Context
context) { super(context, DATABASE_NAME, null, DATABASE_VERSION); }
@Override public void onCreate(SQLiteDatabase db) {
db.execSQL(TABLE_CREATE); } @Override public void onUpgrade(SQLiteDatabase
db, int oldVersion, int newVersion) { db.execSQL("DROP TABLE IF EXISTS " +
TABLE_USERS); onCreate(db); } } LoginActivity.java package com.example.weight;
import android.content.Intent; import android.database.Cursor; import
android.database.sqlite.SQLiteDatabase; import an.
I am looking for some assistance with SQLite database. I have tried se.pdf
1. I am looking for some assistance with SQLite database. I have tried several other scenarios to no
avail. I am looking to have a table in my activity_weight_table.xml, I'm thinking recyclerview
but not sure. Also, I would need help with my login and password checking it agaisnt a database
and having these screens work together. My database should be able to Create: The user should
be able to add items to a database. Delete: The user should be able to remove items from a
database. Update: The user should be able to change the value associated with individual
database items (e.g. the number of a specific item in an inventory or the date of an event). Read:
The user should be able to view all of the database items displayed as a grid. These are my
following Java codes: MainActivity.java package com.example.weight; import
android.content.Intent; import android.os.Bundle; import android.widget.Button; import
android.widget.EditText; import androidx.appcompat.app.AppCompatActivity; public class
MainActivity extends AppCompatActivity { Button button_login, createAccount; EditText
loginUserName, loginPassword; @Override protected void onCreate(Bundle
savedInstanceState) { super.onCreate(savedInstanceState);
setContentView(R.layout.activity_login_weight); button_login =
findViewById(R.id.button_login); loginPassword = findViewById(R.id.loginPassword);
loginUserName = findViewById(R.id.loginUserName); createAccount =
findViewById(R.id.createAccount); createAccount.setOnClickListener((view) -> {
Intent intent = new Intent(MainActivity.this, CreateAccountActivity.class);
startActivity(intent); }); button_login.setOnClickListener((view) -> { Intent
intent = new Intent(MainActivity.this, LoginActivity.class); startActivity(intent); });
} } DatabaseHelper.java package com.example.weight; import android.content.Context;
import android.database.sqlite.SQLiteDatabase; import
android.database.sqlite.SQLiteOpenHelper; public class DatabaseHelper extends
SQLiteOpenHelper { private static final String DATABASE_NAME = "UserAccounts.db";
private static final int DATABASE_VERSION = 1; public static final String
TABLE_USERS = "users"; public static final String COLUMN_ID = "id"; public static
final String COLUMN_USERNAME = "username"; public static final String
COLUMN_PASSWORD = "password"; private static final String TABLE_CREATE =
"CREATE TABLE " + TABLE_USERS + " (" + COLUMN_ID + " INTEGER
PRIMARY KEY AUTOINCREMENT, " + COLUMN_USERNAME + " TEXT, "
+ COLUMN_PASSWORD + " TEXT)"; public DatabaseHelper(Context
context) { super(context, DATABASE_NAME, null, DATABASE_VERSION); }
@Override public void onCreate(SQLiteDatabase db) {
db.execSQL(TABLE_CREATE); } @Override public void onUpgrade(SQLiteDatabase
db, int oldVersion, int newVersion) { db.execSQL("DROP TABLE IF EXISTS " +