I need to log the launcher Activity name for a particular activity in android.
I have tried using the code given in " Get the launcher Activity name of an android application" by doing few modifications like .. 1) I have created a Class called as launcherActivity. 2) In that class I have created a method called as getLauncherActivity(). 3) When I try to call this method in another class it is showing null Object reference.
public class LauncherActivity {
public String getLauncherActivity(Context context){
PackageManager packageManager = context.getPackageManager();
Intent intent = packageManager.getLaunchIntentForPackage(context.getPackageName());
return null;
}
}
I am calling this method has
String launcheractivity=launcherActivity.getLauncherActivity(ctx);
What all changes I need to do to log this launcheractivity name. So please do give Suggestions...
Thank You in Advance:)