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. Random Crash in App

Hello, im developing a SMS unlocker. Its an app that lets you run a
game as a demo and give the option of unlocking it via sms messaging.
The problem is that im having a chash that occurs unexpectedly and i
suspect that it can be because of the way that im managing the flow
control.
Instead of using different activities for the different interfaces,
and switch between activities each time the user choose an option, I
use just one activity and i set
different layouts.

e.g. main menu -> unlock game, play demo, help, about. If the user
chooses about, a new activity is not created, intead of that i set an
about_layout to
the activity that was already running.
When the user (in about section) chooses back option, i set the
main_menu_layout again.

Im having this problem in the emulator as well as in the phone (HTC
G1 (dream))

What I want to know is if the phone (or emulator) is having any
problem by setting different layouts at any time.

The exact error that Im getting is:
The application XXXX (process com.package.android.XXXX) has stopped
unexpectedly. Please try again.



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

2. Errors while building a Standalone tool chain.

Hello Everybody,

I got the answer for my Question.

The Solution is *bash ./build/tools/build-ndk-sysroot.sh --build-out=
~/android/bin/out/target/product/generic
(path to <ANDROID_PRODUCT_OUT>**)*

The PATH for ANDROID_PRODUCT_OUT has to be set correctly..!

Cheers,
Nagendra





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

3. Google Map API limitations for Android

4. Cannot see my HTC Magic via DDMS to take screenshot

5. Inserting large volumes of data into SQLite - speed issues

6. Remote services question

7. How to draw a circle in GL?