Reputation: 101
I have developed an Android app, in which I have created 3 activities. When the app starts, the MainActivity launches the ImageActivity for playing images from the sdcard/Video folder of an android device.
And I have also a VideoActivity is for playing videos from the sdcard/Video. Means the images and videos are stored only in one folder in the called Video(in sdcard).
Now what I want, if ImageActivity starts to play the images then after finishing the images the VideoActivity should start to play the videos, and again ImageActivity should start then after VideoActivity then ImageActivity, and so on.
I have tried a lot for it, but it is not working. Searched for it on this site, but don't get helpful answer.
Upvotes: 2
Views: 694
Reputation: 86
You can do this with passing intent with bundle from one activity to another at every single completion of activity. do the same thing in the second activity to start first one.
Intent i = new Intent(firstactivity.this,secondactivity.class);
Bundle b= new Bundle();
bundle.putStringArrayList("list",list); // Here you have to pass your list data
i.putExtras(bundle);
startActivity(i);
Upvotes: 1
Reputation: 989
This is not a good approach.
It would be better if you use 2 fragments in one Activity. The activity loads the screen again and again but by using a fragment you can inflate those views only. You should create two fragments. One for Image and the second for video.
Upvotes: 0