Created
December 29, 2017 20:22
-
-
Save pavi2410/16812bfba7fb6d6b11342b55a0dee3a8 to your computer and use it in GitHub Desktop.
Get the value of android:name attribute of all activities of an app.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public String getParentPackageName() { | |
PackageManager pm = context.getPackageManager(); | |
String packageName = context.getApplicationContext().getPackageName(); | |
PackageInfo pi; | |
try { | |
pi = pm.getPackageInfo(packageName, PackageManager.GET_ACTIVITIES); | |
} catch (NameNotFoundException e) { | |
e.printStackTrace(); | |
} | |
ActivityInfo[] ai = pi.activities; | |
String activityName = ai[0].name; // Get the value of android:name attribute | |
String parentName = activityName.substring(0, activityName.lastIndexOf(".")); | |
return parentName; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
essme se sirf user kaa naam kaise filter kr sakte hai
like com.shivendrakumarsahu.xyz me se shivendrakumarsahu ko kaise filter kiya jay