arrays - Odd Java String[] error -


i have line of code:

string[] projection = {mediastore.audio.media._id, mediastore.audio.media.artist,           mediastore.audio.media.title, mediastore.audio.media.data,           mediastore.audio.media.display_name,mediastore.audio.media.duration}; 

which should work, eclipse giving me error: "syntax error on token ";", , expected"

here top half of code:

public class main extends activity implements onclicklistener {     listview lv;     static final int check = 1111;      protected void oncreate(bundle savedinstancestate)     {         super.oncreate(savedinstancestate);         setcontentview(r.layout.activity_main);          lv = (listview) findviewbyid(r.id.listview1);         button b = (button) findviewbyid(r.id.button1);         b.setonclicklistener(this);     }     cursor cursor;     string selection = mediastore.audio.media.is_music + " != 0";      string[] projection = {mediastore.audio.media._id, mediastore.audio.media.artist, mediastore.audio.media.title, mediastore.audio.media.data, mediastore.audio.media.display_name, mediastore.audio.media.duration};      cursor = this.managedquery(mediastore.audio.media.external_content_uri, projection, selection, null, null);      private list<string> songs = new arraylist<string>();     while(cursor.movetonext())     {         songs.add(cursor.getstring(0) + "||" + cursor.getstring(1) + "||" +   cursor.getstring(2) + "||" +   cursor.getstring(3) + "||" +  cursor.getstring(4) + "||" +  cursor.getstring(5));     } 

the next line of code:

cursor = this.managedquery(mediastore.audio.media.external_content_uri, projection, selection, null, null); 

needs in method or constructor (or init block of kind). can't hang out loose in class have it. note per @marounmaroun, have other code same problem -- next while loop instance. or declare cursor @ point, though can risky since can't catch exceptions if way if there risk of occurring.

consider organizing code bit better putting variable declarations (i put them @ top), constructors, methods.


Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

CSS3 Transition to highlight new elements created in JQuery -