Switch black screen between activity

I use below code from one of my actions to run another

Intent viewIntent = new Intent(getApplicationContext (), landingPage.class); Bundle b = new Bundle(); b.putString("ApplicationName", a_Bean.getApplicationName()); if (landingPage.getInstanceCount() < 1) bp.landingPage_ProgressDialog = ProgressDialog.show(ViewAllApp.this, "Please wait...", "Retrieving data...", true, false); viewIntent.putExtras(b); viewIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivityForResult(viewIntent,10); Thread background = new Thread(new Runnable() { public void run() { Progresshandler.sendMessage(handler.obtainMessage());//finishes progressDialog }}); background.start(); 

but after starting it shows a black screen and then displays a new action. Can I make a progressdialog to display while the black screen is displayed?

+4
source share
3 answers

I solved the problem above by removing the DataLoader (i.e. methods that download data from the Internet) from the called class (e.g. my landingPage.class) to the calling class.

+1
source

This worked for me:

 Intent intent = new Intent(LocationGrid.this, MainActivity.class); intent.setFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivity(intent); overridePendingTransition(0, 0); 
+3
source

Your code is a bit confusing and unclear. Please indicate the purpose. Anyway, some things that I see:

1. Do not use getApplicationContext (), Activity is the context itself, so it’s better to use:

 new Intent (this, landingPage.class); 

2- You do not need to create a bundle to add a string to an intent.

 viewIntent.addExtra("ApplicationName", a_Bean.getApplicationName ()); 

Anyway, skipping your steps, the application name seems like a terrible idea to me. If you really need the application name in all actions, create the application class as the center point of the application. I really recommend you return to your architecture.

3- Are you sure you want to access the step upon arrival from your father? I assume that an instance of landPage is being created somewhere. I think this is a terrible approach. If I am mistaken, please provide examples.

As for the rest of the code and your exact question, I can’t answer it, I didn’t work with the Progress dialog boxes, but we don’t even know what the β€œbp” variable is, and as I said, you should try asking your question, specifying some points.

+1
source

All Articles