-1

I am creating an app blocking Application and would like to know a few things:

  1. How to load a list of installed apps into a database table.
  2. Create a new table within the database and set the table name through an EditText field or an AlertDialog.
  3. Call in selected apps into another activity
  4. List of apps needs to have a CheckBox next to them to select which apps to carry over to another

Completed Events

  • I have already managed to populate a ListView with all the installed apps.
  • I've set up an AlertDialog with everything I need so far, just need to know how to link that to create a new table and set the entered text as the table name.
  • All layouts have been created and set up to accommodate everything, the problem just lies with the database and calling everything in

I hope I've provided enough details or if this makes any sense at all. Thank you in advance and I hope someone will be able to help me with this problem. If needed I can post segments of my already existing code to make things easier?

1 Answers1

0

For using a Android Database, I recommend to follow this tutorial:

Android | Simple SQLite Database Tutorial

After this tutorial you will understand how the android database works, how you can create tables:

@Override
public void onCreate(SQLiteDatabase db) {
    // SQL statement to create book table
    String CREATE_BOOK_TABLE = "CREATE TABLE books ( " +
                "id INTEGER PRIMARY KEY AUTOINCREMENT, " + 
                "title TEXT, "+
                "author TEXT )";

    // create books table
    db.execSQL(CREATE_BOOK_TABLE);
}

And how to

  1. addItemsToDatabase(Object object)
  2. getItemsFromDatabase(int id)
  3. getAllItemsFromDatabase()
  4. updateItemInDatabase(Object object)
  5. deleteItemFromDatabase(Object object)

When you know all this you can create own methods to use!

Geert Berkers
  • 653
  • 7
  • 19