本文整理汇总了Java中android.content.Context.startActivity方法的典型用法代码示例。如果您正苦于以下问题:Java Context.startActivity方法的具体用法?Java Context.startActivity怎么用?Java Context.startActivity使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.content.Context
的用法示例。
在下文中一共展示了Context.startActivity方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: execute
import android.content.Context; //导入方法依赖的package包/类
public static ActivityScriptExecution execute(Context context, ScriptEngineManager manager, ScriptExecutionTask task) {
ActivityScriptExecution execution = new ActivityScriptExecution(manager, task);
Intent i = new Intent(context, ScriptExecuteActivity.class)
.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
IntentExtras.newExtras()
.put(EXTRA_EXECUTION, execution)
.putInIntent(i);
context.startActivity(i);
return execution;
}
示例2: launch
import android.content.Context; //导入方法依赖的package包/类
public static void launch(Context context) {
Intent intent = new Intent();
intent.setClass(context, XListViewActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_NO_USER_ACTION);
context.startActivity(intent);
}
示例3: actionForward
import android.content.Context; //导入方法依赖的package包/类
/**
* Compose a new message as a forward of the given message.
*/
public static void actionForward(Context context, MessageReference messageReference, Parcelable decryptionResult) {
Intent i = new Intent(context, MessageCompose.class);
i.putExtra(MessageCompose.EXTRA_MESSAGE_REFERENCE, messageReference.toIdentityString());
i.putExtra(MessageCompose.EXTRA_MESSAGE_DECRYPTION_RESULT, decryptionResult);
i.setAction(MessageCompose.ACTION_FORWARD);
context.startActivity(i);
}
示例4: callPhone
import android.content.Context; //导入方法依赖的package包/类
/**
* 拨打电话
*
* @param con
* @param phonenum
*/
public static void callPhone(Context con, String phonenum) {
Intent intent = new Intent();
intent.setAction(Intent.ACTION_CALL);
intent.setData(Uri.parse("tel:" + phonenum));
con.startActivity(intent);
}
示例5: installAPK
import android.content.Context; //导入方法依赖的package包/类
public static void installAPK(Context context, File file) {
if (file == null || !file.exists())
return;
Intent intent = new Intent();
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.setAction(Intent.ACTION_VIEW);
intent.setDataAndType(Uri.fromFile(file), "application/vnd.android.package-archive");
context.startActivity(intent);
}
示例6: storeCertificate
import android.content.Context; //导入方法依赖的package包/类
/**
* Adds a cryptographic file (User certificate, a CA certificate or
* PKCS#12 keychain) through the system's CertInstaller activity.
*
* @param context current application context.
* @param certType cryptographic file type. E.g. CertificateMimeType.X509_USER_CERT
* @param data certificate/keychain data bytes.
* @return true on success, false on failure.
*
* Note that failure only indicates that the function couldn't launch the
* CertInstaller activity, not that the certificate/keychain was properly
* installed to the keystore.
*/
@CalledByNative
public static boolean storeCertificate(Context context, int certType, byte[] data) {
try {
Intent intent = KeyChain.createInstallIntent();
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
switch (certType) {
case CertificateMimeType.X509_USER_CERT:
case CertificateMimeType.X509_CA_CERT:
intent.putExtra(KeyChain.EXTRA_CERTIFICATE, data);
break;
case CertificateMimeType.PKCS12_ARCHIVE:
intent.putExtra(KeyChain.EXTRA_PKCS12, data);
break;
default:
Log.w(TAG, "invalid certificate type: " + certType);
return false;
}
context.startActivity(intent);
return true;
} catch (ActivityNotFoundException e) {
Log.w(TAG, "could not store crypto file: " + e);
}
return false;
}
示例7: launch
import android.content.Context; //导入方法依赖的package包/类
public static void launch(Context context, String input, String phone) {
Intent intent = new Intent(context, SetPassActivity.class);
intent.putExtra(INPUT, input);
intent.putExtra(PHONE, phone);
context.startActivity(intent);
((Activity) context).overridePendingTransition(R.anim.fade_entry, R.anim.hold);
}
示例8: openDefaultSettings
import android.content.Context; //导入方法依赖的package包/类
public static void openDefaultSettings(Context context) {
Intent settingsIntent = new Intent(Settings.ACTION_SETTINGS);
settingsIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(settingsIntent);
}
示例9: start
import android.content.Context; //导入方法依赖的package包/类
public static void start(Context context) {
Intent intent = new Intent(context, CameraActivity.class);
context.startActivity(intent);
}
示例10: start
import android.content.Context; //导入方法依赖的package包/类
public static void start(Context context) {
Intent intent = new Intent(context, SettingsActivity.class);
context.startActivity(intent);
}
示例11: start
import android.content.Context; //导入方法依赖的package包/类
public static void start(Context context) {
Intent starter = new Intent(context, SpanActivity.class);
context.startActivity(starter);
}
示例12: openDail
import android.content.Context; //导入方法依赖的package包/类
public static void openDail(Context context) {
Intent intent = new Intent(Intent.ACTION_DIAL);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(intent);
}
示例13: show
import android.content.Context; //导入方法依赖的package包/类
public static void show(Context context, User info) {
Intent intent = new Intent(context, UserDataActivity.class);
intent.putExtra("user_info", info);
context.startActivity(intent);
}
示例14: start
import android.content.Context; //导入方法依赖的package包/类
public static void start(Context context) {
Intent intent = new Intent(context, AboutActivity.class);
context.startActivity(intent);
}
示例15: startActivity
import android.content.Context; //导入方法依赖的package包/类
public static void startActivity(Context context, String query) {
context.startActivity(new Intent(context, SearchActivity.class)
.putExtra(INTENT_QUERY, query));
}