Skip to content Skip to sidebar Skip to footer

Instance Count Violation In An Android Java App

I am working on an Android application. In abstract, this application has an UI in order to interact with user and it also interacts with a remote service. The remote service adds

Solution 1:

I think the source of the problem is your combination of intent flags. To help you debug this, try to implement the onNewIntent() method in your activity, and log every intent it receives, with something like this:

protectedvoidonNewIntent(Intent intent){
    super.onNewIntent(intent);
    Log.i("my_app", "New intent with flags "+intent.getFlags());
}

This should allow you to see what flags are causing the second call to onCreate() in your logs.

As for the StrictMode instance count violation, I don't think it is worth investigating as explained here.

EDIT Try to use only the flag Intent.FLAG_ACTIVITY_NEW_TASK, e.g., remove the other three flags. Also, keep the android:launchMode to singleTop.

Post a Comment for "Instance Count Violation In An Android Java App"