victor.alm
victor.alm

Reputation: 500

Testing Main/Launcher Activity in Android

We are developing an app with a LoginActivity as main activity but, while developing, we configure the next activity to avoid writing user/password each time. I am starting with TDD and in order to avoid letting the wrong activity, I am trying to create a simple test that check that.

Is there any way to create a test that check what Activity is called when user click on the app icon? I have tried with an ActivityInstrumentationTestCase2 but it only let me choose what activity I want to test, not the complete app.

Thank you

Upvotes: 0

Views: 203

Answers (1)

Joe Bowbeer
Joe Bowbeer

Reputation: 3841

I'm not certain exactly what is being asked, but the launch intent of your application can be obtained via:

getPackageManager().getLaunchIntentForPackage(context.getPackageName())

See for example Get the launcher Activity name of an android application

Upvotes: 1

Related Questions