I've created a Database helper class for SQLite database and I want to create an instance of it inside my fragment. But no table is created.
UserDatabaseHelper.java
public static final String DATABASE_NAME = "Users.db" ;
public static final String TABLE_NAME = "User_table" ;
public static final String COL_1 = "Username" ;
public static final String COL_2 = "Email" ;
public static final String COL_3 = "Password" ;
public UserDatabaseHelper(Context context) {
    super(context, DATABASE_NAME, null, 1);
}
@Override
public void onCreate(SQLiteDatabase db) {
    db.execSQL("create table "+ TABLE_NAME+ "(Username TEXT PRIMARY KEY ," +
            " Email TEXT, Password TEXT)");
}
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
    db.execSQL("DROP TABLE IF EXISTS " + TABLE_NAME);
    onCreate(db);
}
public boolean insertData(String username , String email , String password ) {
    SQLiteDatabase db = this.getWritableDatabase();
    ContentValues contentValues = new ContentValues() ;
    contentValues.put(COL_1,username);
    contentValues.put(COL_2,email);
    contentValues.put(COL_3,password);
    long result = db.insert(TABLE_NAME , null , contentValues) ;
    if (result == -1) return false ;
    else return true ;
}
public boolean checkUser(String username) {
    SQLiteDatabase db = this.getReadableDatabase();
    Cursor cursor = db.rawQuery("select * from user where username=?",new String[]{username}) ;
    if (cursor.getCount()>0) return false ;
    else return true ;
}
SignUpFragment.java
UserDatabaseHelper myDb ;
EditText username_signup , email_signup , password_signup , password_signup_repeat ;
CheckBox checkup ;
Button signup_btn ;
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.signup_fragment,container ,false);
    username_signup = view.findViewById(R.id.username_signup);
    email_signup = view.findViewById(R.id.email_signup);
    password_signup = view.findViewById(R.id.password_signup);
    password_signup_repeat = view.findViewById(R.id.password_signup_repeat);
    checkup = view.findViewById(R.id.checkup);
    signup_btn = view.findViewById(R.id.signup_btn);
    myDb = new UserDatabaseHelper(getActivity());
    return view;
}
After creating an instance the database table is supposed to be created but nothing happens. I've tried to change my code to
SQLiteDatabase myDb ;
and then
myDb = new UserDatabaseHelper(getActivity()).getWritableDatabase(); 
In this condition the table is created but I can't call the checkuser and insert methods which are in the helper class. What should I do? What's wrong with my code?
 
     
    