java - Getting Values from a class & store them in an ArrayList -


i have images & sounds set in separate classes.i want call them in main activity. want put 3 images

 a1.setrightimage(r.drawable.play_blue_1);                       list<integer> l1 = new arraylist<integer>();  l1.add(r.drawable.play_blue_2);  l1.add(r.drawable.play_blue_3);  

in array list , use them set on different imageviews.

             //setting sound @ start             q1.setquestionsound(r.raw.touch_blue);              //first image             a1.setrightimage(r.drawable.play_blue_1);             // second list contains 2 images                   list<integer> l1 = new arraylist<integer>();             l1.add(r.drawable.play_blue_2);             l1.add(r.drawable.play_blue_3);             //adding them answer object                                 a1.setwrongimages(l1);              //another image              a1.setbigimage(r.drawable.big_play_blue);             a1.setsuccesssound(r.raw.thats_correct);             a1.setfailuresound(r.raw.no_its_wrong);              q1.setanswer(a1); 

i using in main activity not able output . printing null. want data , print obtained result values:

myarraylist.add(gpquestion.getanswer().getrightimage());     myarraylist.addall(gpquestion.getanswer().getwrongimages());     arraylist.add(myarraylist.get(0));     arraylist.add(myarraylist.get(1));      (int = 0; < arraylist.size(); i++) {         arraylist.add(myarraylist.get(i));         system.out.println(myarraylist.get(i));     } 

atleast if print them, can use them in methods.thank you.

better use sharedpreferences

http://android-er.blogspot.in/2011/01/example-of-using-sharedpreferencesedito.html

or

application class

http://www.devahead.com/blog/2011/06/extending-the-android-application-class-and-dealing-with-singleton/


Comments

Popular posts from this blog

Change php variable from jquery value using ajax (same page) -

Pull out data related to my apps from Android Play Store and iOS App Store -

How can I fetch data from a web server in an android application? -