2

I am retrieving file info from the another activity into my main activity.But I facing the Unchecked assignment problem.My code is as follows.Would anyone can tell me what to do to solve this problem.

    Intent i = getIntent();
    Bundle b = i.getExtras();
    mysongs = (ArrayList) b.getParcelableArrayList("songlist");// This line shows this problem.
    int position = b.getInt("pos",0);
    Uri uri = Uri.parse(mysongs.get(position).toString());
    mediaPlayer = MediaPlayer.create(getApplicationContext(),uri);
    mediaPlayer.start();

I tried this line by declaring it into globally.but the problem is I cann't set the bundel b into this(when i declare it globally).

  • how to set ArrayList "songList" in Activity? Why not use OnActivityOnResult? – fechidal89 Sep 05 '15 at 21:30
  • What type of array is mysongs? – hoomi Sep 05 '15 at 22:02
  • mysongs is File type Arraylist...I am trying follwing code ArrayList mysongs= (ArrayList) b.getParcelableArrayList("songlist"); by writting it globally but still show an error. – Abdullah Al Noman Sep 06 '15 at 04:44
  • I set arrylist through an arrylist instance vaiable.....like ArrayList mysongs; and then use getIntent to get the bundle b .After that i Just store the mysongs using getparcelebelarraylist. @ fechidal – Abdullah Al Noman Sep 06 '15 at 04:48

0 Answers0