problem accessing run( ) in android

by Rahul » Thu, 22 Apr 2010 18:59:01 GMT


Sponsored Links
 i i have a problem accessing run() method in my program. The rum
method is not getting focus at all. The Log message that is present
outside the loop is getting displayed and i am getting a blank screen
with preset background.Here's the code...


public class MusicListActivity extends Activity {
List<HashMap<String, String>> songNodeDet = new
ArrayList<HashMap<String,String>>();
HashMap<?,?>[] songNodeWeb;
XMLRPCClient client;
String logInSess;
ArrayList<String> paths=new ArrayList<String>();
public ListAdapter adapter ;
Object[] websongListObject;
List<SongsList> SongsList=new ArrayList<SongsList>();
Runnable r;
ProgressDialog p;
ListView lv;

@Override
public void onCreate(Bundle si){
super.onCreate(si);

setContentView(R.layout.openadiuofile);
lv=(ListView)findViewById(R.id.list1);
r=new Runnable(){

public void run(){
try{

getSongs();
list();
Log.d("handler","handler");
removeDialog(0);
p.dismiss();


} catch (MalformedURLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (XMLRPCException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
};
Log.e("***","process over");
}

@Override
protected void onResume() {
// TODO Auto-generated method stub
super.onResume();

}

public void webObjectList(Object[] songListObj) throws
XMLRPCException{
songNodeWeb = new HashMap<?,?>[songListObj.length];


for(int i=0;i<songListObj.length;i++){
songNodeWeb[i]=(HashMap<?,?>)songListObj[i];
String nodeid=(String) songNodeWeb[i].get("nid");

Log.e("Song",i+"completed");
HashMap<String,String> nData=new HashMap<String,String>();
nData.put("nid",nodeid);
Object nodeget=client.call("node.get",nodeid);
HashMap<?,?> songNode=(HashMap<?,?>)nodeget;
String title=(String) songNode.get("title");
String album=(String) songNode.get("album");
String artist=(String) songNode.get("artist");

nData.put("title", title);
nData.put("album", album);
nData.put("artist", artist);

Object[] songObject=(Object[])songNode.get("title_format");
HashMap<?,?>[] songDetails=new HashMap<?,?
songDetails[0]=(HashMap<?, ?>)songObject[0];
String path=(String) songDetails[0].get("filepath");


if(path.contains(" ")){
path=path.replace(" ", "%20");
}

String songPath="http://www.gorinka.com/"+path;
paths.add(songPath);
nData.put("path", songPath);
Log.e("my path",path);
SongsList songsList=new SongsList(title, album,
artist,songPath,songPath);
SongsList.add(i,songsList);
songNodeDet.add(i,nData);
}

Log.e("paths values",paths.toString());
handler.sendEmptyMessage(0);
}

public void list()
{ Log.d("#####"



problem accessing run( ) in android

by krox » Fri, 23 Apr 2010 02:42:16 GMT


 i!

Just took a really quick look but AFAICT you try to start the runnable
r from getSongs() but getSongs() is only called from the runnable r,
hence a moment 22. So you probably have to start the runnable r from
onCreate()/onStart() as well (however AFAICT you gonna end up in a
loop calling getSongs() over and over again). But as I said I only
took a really quick look and might have overlooked something....

/Erik

On Apr 22, 12:58pm, Rahul <rahulvarma.kalidindi0...@gmail.com> wrote:
>


Sponsored Links


Other Threads

1. how can I get the Google account or Gmail address from the phone

thank you very much :D




> 

2. gayda

Dear all, ada yg bs japri apk gaydar? udah dicari kemana2 tp belum
nemun jg. Mungkin harus mampir dulu ke TL. Thanx b4 and after.

-- 
"Indonesian Android Community [id-android]" 

3. Deploy my app on HTC

4. how can I get the Google account or Gmail address from the phone

5. Not download an example, but an example on downloading...

6. Sorry, this video cannot be played

7. How to get the soft keyboard input with out edit text?