Joris Weimar
Joris Weimar

Reputation: 4931

Can Android OS start app with different Activity than Launcher Activity?

I have an app that is showing some weird bugs. The app gets in a state where some global data is null that is not supposed to be null (looking at the logic of the app, there is no way to get to that state). I am suspecting that the OS is either overwriting global data by itself or it's restarting my app (or starting my app) and bypassing the initial Activity. Is any of these scenarios possible? (Of course my logic could always be wrong, but at this point I am really suspecting something else is going on).

Upvotes: 1

Views: 428

Answers (4)

Chris Stratton
Chris Stratton

Reputation: 40357

YES this is in fact to be expected in a variety of cases:

  1. If your application goes to the background and Android ends up killing it to reclaim resources, a subsequent return to that might look seamless to the user, but actually happens in a brand new application process. The return would be directly to the Activity they were last in, but in a new process. The onCreate() of other activities in the package (such as your launcher activity) will not be called, unless those activities are explicitly re-visited by user navigation or by an Intent from somewhere.

  2. A Launcher activity (ie, something with android.intent.category.LAUNCHER) is not the only point of entry you can have in your application. Many applications contain activities which have intent filters which register them to handle android.intent.action.VIEW with a category of android.intent.category.DEFAULT and a specification of some type of content which they can handle. An applications of this sort may not even have a launcher activity in the package at all (though one might be included to browse content, or set configuration options, or for other functionality)

Upvotes: 2

Kumar Vivek Mitra
Kumar Vivek Mitra

Reputation: 33534

Launcher is used to identify the activity which is to be launched as the application starts.... so i dont think so its possible...

Upvotes: 0

Roy Hinkley
Roy Hinkley

Reputation: 10641

I highly doubt it. The idea of the launcher is that is defines the activity that receives the launch intent from the OS.

Guessing from the behavior you described, you may want to do some research on Activity life cycles.

Upvotes: 0

AAnkit
AAnkit

Reputation: 27549

 Can Android OS start app with different Activity than Launcher Activity?

No, It always search an activity with launcher tag to start with.

Add your code, and be specific which global data is getting null value :)

Upvotes: 0

Related Questions