本文整理匯總了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));
}