View not attached to window manager

by PaulJ » Tue, 23 Nov 2010 14:54:21 GMT


Sponsored Links
 Hello,

I'd like to ask about how to proper handle progressDialog in
Thread, since getting the error from subject.

My code:

Thread logThread = new Thread()
{
String result = new String();

@Override
public void run()
{
Looper.prepare();

try
{
result = ofsomesomeoperation();
}
catch (NoSuchAlgorithmException e)
{

}

logHandler.post(new Runnable()
{
public void run()
{
if (result.equals(something1))
{
dialogLogProg.dismiss();
showDialog(dialog_something1);
}
else
{
dialogLogProg.dismiss();
Intent newint = new Intent(Example.this,NewInt.class);
startActivity(newint);
Example.this.finish();
}
}
});
Looper.loop();
}
};
logThread.start();

Problem occurs when a dialog progress appears and I change my phone
orientation, it freezes and crashes, on line with dismiss(). I've seen
some
discussion about this but my English is poor, so I hope for some
running
examples on my code. Thank you.

Greetings.

-- 



Re: View not attached to window manager

by TreKing » Wed, 24 Nov 2010 07:08:37 GMT


 



For starters, if you use showDialog(), use dismissDialog() instead of
calling dismiss on the dialog directly.

-------------------------------------------------------------------------------------------------
TreKing < http://sites.google.com/site/rezmobileapps/treking> ; - Chicago
transit tracking app for Android-powered devices

-- 


Sponsored Links


Other Threads

1. Make an Alert for a background process

hi all;

I have a background process that save data in my sdcard how can i be
alert ?!!
it is an application run in background
thx for your help
--~--~---------~--~----~------------~-------~--~----~

2. Initial database population from large data files, several problems

Justin,

You might find this article of interest. This is a technique to pre-
populate the database and bundle into the assets directory of your
application.

http://www.reigndesign.com/blog/using-your-own-sqlite-database-in-android-applications/

Al.



--~--~---------~--~----~------------~-------~--~----~

3. android startup problem after moving from SDK-1.0 to 1.5

4. is there any document for porting ??

5. Android 1.5 - How does MediaPlayer know when to start playback?

6. Dev guide changelog.

7. cupcake 1.5 r1 surfaceCreated is not called!!!