1

I have an application that raises from service on scheduled time. In that service, i have displayed my Activity using Intent. It works perfectly. But, when i go back, the activity is finished. But, one blank screen is remaining there? How can i avoid this blank screen. I need my application's Activity instead of blank screen. Anyone Guide me.

Praveenkumar
  • 24,084
  • 23
  • 95
  • 173

5 Answers5

3

@Špĸ remove this line: i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);

take a look at my post if you wish to open a dialog via your service: Creating global dialogs

Sherif elKhatib
  • 45,786
  • 16
  • 89
  • 106
1

I don't like that you finish an activity that you go back to. You have multiple of different alternatives:

Using fragments instead of activity intents.

Set flag to indicate the activity is done so it will close when you go back.

You could also try to work with the stack, look at this: https://stackoverflow.com/a/4038637/969325

Community
  • 1
  • 1
Warpzit
  • 27,966
  • 19
  • 103
  • 155
1

Without seeing the code it is very diffcult to find out what is going wrong in your code but still I am making some effort to help you.

Add android:theme="@android:style/Theme.Translucent" to your activity tag in your manifest file and then try if it works or not.

Vineet Shukla
  • 23,865
  • 10
  • 55
  • 63
0

Have you tried setting FLAG_ACTIVITY_NO_HISTORY in the intent you use to start the AlertDialog activity or launchMode="noHistory" in the manifest.

The AlertDialog activity may very well be the blank screen you're seeing as no content view is set and the only thing a user sees is an alert dialog so once the alert dialog is dismissed and the app goes back to this screen it would be blank.

triggs
  • 5,890
  • 3
  • 32
  • 31
0

Before press back button, you have to save the state of the activity and restore the activity while come front. This is easily done by onRetainNonConfigurationInstance() and getLastNonConfigurationInstance() method. Please refer this link.

Akilan
  • 1,707
  • 1
  • 16
  • 30