Search code examples
androiddatabasesqliteandroid-activity

SQLite database: Writing and reading data between multiple activities within Android Studio


Using Android studio and the SQLite database:

I have an activity which populates a SQLite database with a few data types per entry.

I want to be able to have another activity that can read this data however, I am not sure how to access the same database via another activity. At the moment I'm not sure if I should pass it as a bundle or whether there is access method.

Thanks in advance


Solution

  • First create a new class eg:- Data

    create public static String userid; in it

    then use Data.userid = sqlitedata and then you can use Data.userid anywhere in your project it will return the same value...