Difference standard, singleTop, singleInstance, singleTask

standard (default) :- Multiple instances of the activity class can be instantiated and multiple instances can be added to the same task or different tasks. This is the common mode for most of the activities.

singleTop :- The difference from standard is, if an instance of the activity already exists at the top of the current task and the system routes the intent to this activity, no new instance will be created because it will fire off an onNewIntent() method instead of creating a new object.

singleTask:- A new task will always be created and a new instance will be pushed to the task as the root. However, if any activity instance exists in any tasks, the system routes the intent to that activity instance through the onNewIntent() method call. In this mode, activity instances can be pushed to the same task. This mode is useful for activities that act as the entry points.

singleInstance:- Same as singleTask, except that the no activities instance can be pushed into the same task of the singleInstance’s. Accordingly, the activity with launch mode is always in a single activity instance task. This is a very specialized mode and should only be used in applications that are implemented entirely as one activity.

source: http://stackoverflow.com/questions/25773928/setting-launchmode-singletask-vs-setting-activity-launchmode-singletop

To translate for my language:

We have 3 activities A>B>C and we are now in C

  1. standard  – creates everytime new activity. There is nothing to explain.
  2. singleTop – when we are in C and we want startActivity A it will create another A, but when we startActivity C it won’t create it because C is on top
  3. singleTask – when we are in C and we want startActivity A, it will bring to front A, but when we startActivity C it won’t create it because C is the current task
  4. singleInstance – imho don’t know 😀 above explanation might help a bit

How to run an android application using .apk file?

Here is the example how to run apk when you do not know what is the apk’s name.

First you need to call aapt to get info about AndroidManifest.xml from interesting apk. I will show you example on WifiKillDOwnloader.apk
In console you call:

aapt d xmltree WiFiKillDownloader.apk AndroidManifest.xml > manifest.txt

Console will output this:

Continue reading “How to run an android application using .apk file?”