方法1:
//第一个参数是Activity所在的package包名,第二个参数是完整的Class类名(包括包路径)
ComponentName componetName = new ComponentName("com.gohoc.afinancegeek",
"com.gohoc.afinancegeek.StartPageActivity");
Intent intent = new Intent();
intent.setComponent(componetName);
startActivity(intent);
方法2:
调用方法:
Intent intent = new Intent();
intent.setAction("com.fid.band_module.ui.activity.lurk.LurkMainActivity");
intent.addCategory("android.intent.category.DEFAULT");
startActivity(intent);
检查第三方应用的Activity是否存在:
//新版相机调用方式
Intent newTakePhoto = new Intent();
newTakePhoto.setAction(MediaStore.ACTION_IMAGE_CAPTURE);
newTakePhoto.putExtra(Constants.APP_NAME, getPackageName());
newTakePhoto.putExtra(MediaStore.EXTRA_OUTPUT, getDiskCacheDir(this));
newTakePhoto.putExtra(Constants.LEFT_TEXT_NEW, "取消");
newTakePhoto.putExtra(Constants.RIGHT_TEXT_NEW, "保存");
if(newTakePhoto.resolveActivity(getPackageManager()) != null){
LogUtil.d(TAG, "用的是统一调起相机的方式");
startActivityForResult(newTakePhoto, Constants.PHOTO_REQUEST_CODE);
}
被调用Activity得在manifest添加如下信息:
<activity
android:name=".ui.activity.lurk.LurkMainActivity"
android:screenOrientation="portrait" >
<intent-filter>
<action android:name="com.fid.band_module.ui.activity.lurk.LurkMainActivity" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>