Firebase Android open activity using List view sub item

Mohan Adhikari Source

I'm trying to open a specific activity using the list view onItemClick listener.

Currently, I have it opening a single activity, based on the unique id that is created when the data is saved.

My opening activity code.

listViewWorkouts.setOnItemClickListener(new AdapterView.OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
            WorkoutDB viewworkout = workoutList.get(i);
           Intent intent = new Intent(getApplicationContext(),AddDetailActivity.class);
           intent.putExtra(WORKOUT_ID, viewworkout.getWorkoutId());
           intent.putExtra(WORKOUT_NAME, viewworkout.getWorkoutName());
           intent.putExtra(WORKOUT_CATEGORY, viewworkout.getWorkoutCategory());
startActivity(intent);
   }
 });

.

I need it so that when i click "Other" or "Cardio" it opens their specific page with their id

javaandroidfirebasefirebase-database

Answers

comments powered by Disqus