updating listview after thread

Put problem concerning Views, Layouts and other XML-Resources (like AndroidManifest) here.

updating listview after thread

Postby guruk » Thu Mar 12, 2009 6:17 pm

Hi,

I have a Listview filled with Items in the Array mStrings[]
and a Textview Area filled with Items in Array mTexte[]

Usualy I easily can change the content of the listview by mStrings[1]="test"
and the same with the mTexte Items.

But now I read some data from the net in a thread (got the code in the net)
and there is also a updater where I also can change text in my GUI.
There for example I can change Text mTexte[1]="test" and it chance
my Textview.. cool. But it does not work with my Listview.

Before I start the Handler it works for both, mTexte and mStrings.
but while the Handler is active I only can change mTexte??

Whats wrong? How can I chance my mStrings in the showUpdate
or after the Thread is finished?

Here my code

mStrings[1]="111111111111"; mTexte[1]="111111";
mHandler = new Handler();
checkUpdate.start();
mStrings[1]="33333333333";
mTexte[1]="333333";

}

//------------------------------------------------------------------

private Thread checkUpdate = new Thread() {
public void run() {
try {

String mediaUrl = "http://www.xxxx.com/3gp/tibet.txt";
URLConnection conn = new URL(mediaUrl).openConnection();
InputStream is = conn.getInputStream();
BufferedInputStream bis = new BufferedInputStream(is);
byte buf[] = new byte[8192];
while((current = bis.read(buf)) != -1){
infomessage= ""+current; mHandler.post(showUpdate);

}

infomessage="Finished"; mHandler.post(showUpdate);
} catch (Exception e) {
}
}
};


private Runnable showUpdate = new Runnable(){
public void run(){
mTexte[1]="222222222";
mStrings[1]="22222222222";
}
};



thanks
chris
guruk
Junior Developer
Junior Developer
 
Posts: 24
Joined: Sun Mar 08, 2009 8:05 pm

Top

Return to View, Layout & Resource Problems

Who is online

Users browsing this forum: No registered users and 8 guests