3

I created a database using sqlitedbhelper and I am able to switch from one activity to other activity on button click. Now I want to retrieve the data from my database on same button click and it should display on other activity. Here is my activity code

    public class Assessment extends Activity 
    {
        private static String DB_PATH = "/data/data/+com.comply.assessment()+/Database/"; 
        private static final String DATABASE_NAME = "LMS_MST";
        SQLiteDatabase db;
        TextView mod_code,qst_code,question_id,question,qst_opt1,qst_opt2,qst_opt3,qst_opt4,correct_ans,user_ans;
        Cursor cursor;
        private Button start_test; 
        @SuppressWarnings("unused") 
        @Override
        public void onCreate(Bundle savedInstanceState) 
        {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.main);

            start_test=(Button)findViewById(R.id.start_test);
            start_test.setOnClickListener(this);

            public void onClick(View v) 
            {
                Intent intent1= new Intent(Assessment.this,Get_Assessment.class);
                startActivity(intent1);
            }
        }
    }

Please I want help.

Any kind of examples would be thankful.

RAS
  • 8,100
  • 16
  • 64
  • 86
naleshmadur
  • 95
  • 1
  • 10

1 Answers1

3

This post is something that I always refer to when I am using SQLite DB in android.

Hope it helps you too!

Community
  • 1
  • 1
Anand Sainath
  • 1,807
  • 3
  • 22
  • 48