How to write Sqlite database in Fragment Android : 
while i am creating a database  on android sqlite database with fragment if i i write inside the onViewCreated method couldn't write the database name and Listview findviewbyid get error  i don't know.what i tried so i wrote below.

cannot resolve the method openOrCreateDatabase

      SQLiteDatabase db = openOrCreateDatabase("course", Context.MODE_PRIVATE, null);
    

      lst1 = findViewById(R.id.lst1);

 cannot resolve the method findViewById

 cannot resolve the constructor ArrayAdapter

     **arrayAdapter = new ArrayAdapter(this, `R.layout.support_simple_spinner_dropdown_item, titles);**`
 

     lst1 = findViewById(R.id.lst1);
     ListView lst1;
        ArrayList<String> titles = new ArrayList<String>();
        ArrayAdapter arrayAdapter;
            @Override
           public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
                super.onViewCreated(view, savedInstanceState);
              
                SQLiteDatabase db = openOrCreateDatabase("course", Context.MODE_PRIVATE, null);
                lst1 = findViewById(R.id.lst1);
                final Cursor c = db.rawQuery("select * from category", null);
                int id = c.getColumnIndex("id");
                int title = c.getColumnIndex("title");
                int description = c.getColumnIndex("description");
        
                titles.clear();
                arrayAdapter = new ArrayAdapter(this, R.layout.support_simple_spinner_dropdown_item, titles);
                lst1.setAdapter(arrayAdapter);
                final ArrayList<cate> cat = new ArrayList<cate>();
                if (c.moveToFirst()) {
                    do {
                        cate stu = new cate();
                        stu.id = c.getString(id);
                        stu.course = c.getString(title);
                        stu.description = c.getString(description);
                        cat.add(stu);
                        titles.add(c.getString(id) + " \t " + c.getString(title) );
        
                    } while (c.moveToNext());
                    arrayAdapter.notifyDataSetChanged();
                    lst1.invalidateViews();
                }
                lst1.setOnItemClickListener(new AdapterView.OnItemClickListener() {
                    @Override
                    public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
        
                        String aa = titles.get(position).toString();
                        cate stu = cat.get(position);
                        Intent i = new Intent(getApplicationContext(), editcategory.class);
                        i.putExtra("id", stu.id);
                        i.putExtra("category", stu.course);
                        i.putExtra("description", stu.description);
                        startActivity(i);
                    }
                });
            }

