Friday, September 23, 2011

Get Current Activity and Package Name in android

Get Current Activity  and Package Name in android.

    ActivityManager am = (ActivityManager) this .getSystemService(ACTIVITY_SERVICE);
   List<RunningTaskInfo> taskInfo = am.getRunningTasks(1);
    ComponentName componentInfo = taskInfo.get(0).topActivity;
    Log.d(WebServiceHelper.TAG, "CURRENT Activity ::" + taskInfo.get(0).topActivity.getClassName()+"   Package Name :  "+componentInfo.getPackageName());
   

1 comment:

  1. hi,
    I wanted to ask:
    is it possible to get the information about the content of the activity also?
    example: I have an activity, which displays a picture. Can I get the name of that picture also?
    thanks in advance

    ReplyDelete

Check out this may be help you

Related Posts Plugin for WordPress, Blogger...