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());
   

Check out this may be help you

Related Posts Plugin for WordPress, Blogger...