指定启动包内的其他Activity

private void startOtherActivity(){
			  try {
					PackageInfo pInfo=getPackageManager().getPackageInfo(getPackageName(), PackageManager.GET_ACTIVITIES);
					ActivityInfo[] ainfos=pInfo.activities;
					String actName=ainfos[1].name;
					Intent intent=new Intent();
					intent.setComponent(new ComponentName(getPackageName(), actName));
					startActivity(intent);
					System.out.println(ainfos.length);
				} catch (NameNotFoundException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				}
		        
		}

你可能感兴趣的:(Activity)