public class Main extends Activity implements Runnable ??? Never do things like this please! Activity instances should *only* forked by the system, But not you.
On Aug 17, 9:06 pm, Johan <[email protected]> wrote: > I've tried different things, but I still keep the same error: > > android.view.WindowManager$BadTokenException: Unable to add window -- > token android.os.BinderProxy@40513880 is not valid; is your activity > running? > > At this line: alertDialog.show(); > > Can you look at the code? > > /** Called when the activity is first created. */ > @Override > public void onCreate(Bundle icicle) { > super.onCreate(icicle); > setContentView(R.layout.splashscreen); > > LoadData(); > } > > public void LoadData() > { > Thread t1 = new Thread(this); > t1.start(); > } > > private Handler handler = new Handler() > { > @Override > public void handleMessage(Message msg) > { > if(!rssItems.isEmpty()) > { > switch (msg.what) { > case STOPSPLASH: > //remove SplashScreen from view > //splash.setVisibility(View.GONE); > Intent intent = new Intent( > "news.displayNews"); > > intent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP | > Intent.FLAG_ACTIVITY_CLEAR_TOP); > NewsDisplayer.rssItems.clear(); > > NewsDisplayer.rssItems.addAll(rssItems); > > startActivity(intent); > Close(); > break; > } > } > else > { > AlertDialog.Builder builder = new > AlertDialog.Builder(Main.this); > builder.setMessage("No conncection.") > .setTitle("error...") > .setCancelable(false) > .setPositiveButton("Again", new > DialogInterface.OnClickListener() { > public void onClick(DialogInterface > dialog, int id) > { > dialog.dismiss(); > LoadData(); > } > }) > .setNegativeButton("Close", new > DialogInterface.OnClickListener() { > public void onClick(DialogInterface > dialog, int id) > { > dialog.dismiss(); > System.exit(0);; > } > }); > > AlertDialog alert = builder.create(); > alert.show(); > } > } > }; -- You received this message because you are subscribed to the Google Groups "Android Developers" 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-developers?hl=en

