指定程序打开指定文件及启动系统设置相关界面


Intent intent = new Intent(Intent.ACTION_VIEW); intent.addCategory(Intent.CATEGORY_DEFAULT); // intent.setComponent(new ComponentName("com.android.htmlviewer", "com.android.htmlviewer.HTMLViewerActivity")); // intent.setComponent(new ComponentName("com.estrongs.android.pop", "com.estrongs.android.pop.app.PopNoteEditor")); intent.setData(Uri.fromFile(file)); intent.setDataAndType(Uri.fromFile(file), "text/plain"); intent.setFlags(Intent.FLAG_ACTIVITY_FORWARD_RESULT); startActivity(intent);

需注意两点:

一:setComponent,前面是包名,后面是带包名的执行类。

二:setDataAndType,第二个参数必须明确指定文件格式。

 

 启动系统设置相关界面


public static void startAPNActivity(Activity activity, int requestCode) {
		Intent intent = new Intent(
				android.provider.Settings.ACTION_APN_SETTINGS);
		activity.startActivityForResult(intent, requestCode);
	}

Action常量参考  http://developer.android.com/reference/android/provider/Settings.html

你可能感兴趣的:(qq,File)