Ok, I'm trying with this now:
showDialog(DIALOG2_KEY);
new Thread(new Runnable(){
public void run(){
TwitAdapter twadapter = new TwitAdapter(
getBaseContext(),
R.layout.list_item , fillTwitter("
http://twitter.com/statuses/public_timeline.xml?count=10")
);
setListAdapter(twadapter);
}
}).start();
removeDialog(DIALOG2_KEY);
but it crashes saying:
01-19 23:33:36.294: ERROR/AndroidRuntime(310):
android.view.ViewRoot$CalledFromWrongThreadException: Only the original
thread that created a view hierarchy can touch its views.
Any ideas?
On Fri, Jan 16, 2009 at 12:03 PM, Ivan Soto <[email protected]> wrote:
> I've been trying to do that:
>
> showDialog(DIALOG2_KEY);
> new Thread(new Runnable(){
> public void run(){
> TwitAdapter twadapter = new TwitAdapter( this,
> R.layout.list_item , fillTwitter("
> http://twitter.com/statuses/public_timeline.xml?count=10")
> );
> setListAdapter(twadapter);
> }
> }).start();
> removeDialog(DIALOG2_KEY);
>
> but it won't run because I need to refer to the context instead of "this"
> in the TwitAdapter.
>
> And I have no idea how to do that.
>
> Any help?
>
>
> On Fri, Jan 16, 2009 at 6:47 AM, conan <[email protected]> wrote:
>
>>
>> Write your adapter code in a separate handler thread.
>>
>> HTH
>>
>> On Jan 16, 10:55 am, "Ivan Soto" <[email protected]> wrote:
>> > Hi I'm trying to display a Loading dialog, however it shows up AFTER it
>> > shows the listadapter. this is the code:
>> >
>> > showDialog(DIALOG2_KEY);
>> >
>> > TwitAdapter twadapter = new TwitAdapter(
>> > this,
>> > R.layout.list_item , fillTwitter("
>> http://twitter.com/statuses/public_timeline.xml?count=10")
>> > );
>> > setListAdapter(twadapter);
>> > removeDialog(DIALOG2_KEY);
>> >
>> > any idea?
>> >
>> > Thanks
>>
>> >>
>>
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en
-~----------~----~----~----~------~----~------~--~---