每天深入android一点点 ^.^
[java] 知道怎么样获取自己应用当前包(package.)下所有的Activity下 我们可以利用android 提供的PackageInfo类来实现
[java]
try {
PackageInfo pi = getPackageManager().getPackageInfo(
"Activity所在包名", PackageManager.GET_ACTIVITIES);
mActivities = new ArrayList<ActivityInfo>(Arrays.asList(pi.activities));
String ourName = getClass().getName();
for (int i = 0; i < mActivities.size(); ++i) {
if (ourName.equals(mActivities.get(i).name)) {
mActivities.remove(i);
break;
}
}
} catch (PackageManager.NameNotFoundException e) {
// Do nothing. Adapter will be empty.
}
[java]
[java]
是不是很巧妙
补充:移动开发 , Android ,