4
I have a very simple project to test that at the event onCreate from screen 1 sends a notification, which by clicking opens screen 2.
Purposely, I quickly click on the notification to open the new screen (in order to test) doing a kind of "Stress" to simulate some kind of error.
The problem is that time opens normally and other times there is a white screen.
Why does this happen?
I tested on 3 devices:
- Samsung CORE 2 - DIDN’T WORK EVERY TIME.
- Samsung Galaxy S3 mini - WORKED ALL THE TIME.
- Samsung Galaxy s duos - GAVE PROBLEM A FEW TIMES
Does this have to do with RAM, processor? Or is my code running in the wrong order?
public void sendNotification() {
int NOTIFICATION_ID = 1;
NotificationManagerCompat nm = NotificationManagerCompat.from(this);
Intent it = new Intent(this, NovaTela.class);
TaskStackBuilder stackBuilder = TaskStackBuilder.create(this);
stackBuilder.addParentStack(NovaTela.class);
stackBuilder.addNextIntent(it);
PendingIntent pit = stackBuilder.getPendingIntent(
0, PendingIntent.FLAG_CANCEL_CURRENT);
NotificationCompat.Builder mBuilder =
new NotificationCompat.Builder(this)
.setDefaults(Notification.DEFAULT_ALL)
.setAutoCancel(true)
.setContentIntent(pit)
.setSmallIcon(R.mipmap.ic_launcher)
.setContentTitle("Teste Notificação")
.setContentText("teste");
nm.notify(NOTIFICATION_ID, mBuilder.build());
}
Friend, do a test: add the ACTIVITY_NEW_TASK flag to open the Novatela: Intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
– Thiago Luiz Domacoski
I’ve tried and it’s still the same problem....
– Leonardo Rocha
Displays an error in Logcat?
– Thiago Luiz Domacoski
None, so I would like to understand why sometimes appears the white screen where I can click on the elements in the background but I can not see anything, being that in some devices work normally...
– Leonardo Rocha