读书人

Android 实现Activity靠山运行

发布时间: 2013-09-11 16:26:28 作者: rapoo

Android 实现Activity后台运行

第一种方法

?

void startActivitySafely(Intent intent) {intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);try {startActivity(intent);} catch (ActivityNotFoundException e) {Toast.makeText(this, R.string.unabletoopensoftware,Toast.LENGTH_SHORT).show();} catch (SecurityException e) {Toast.makeText(this, R.string.unabletoopensoftware,Toast.LENGTH_SHORT).show();Log.e(TAG,"Launcher does not have the permission to launch "+ intent+ ". Make sure to create a MAIN intent-filter for the corresponding activity "+ "or use the exported attribute for this activity.",e);}}

?

1 楼 384444165 2010-11-11 so good .Thanks

读书人网 >Android

热点推荐