本文整理汇总了Java中android.content.Intent.setFlags方法的典型用法代码示例。如果您正苦于以下问题:Java Intent.setFlags方法的具体用法?Java Intent.setFlags怎么用?Java Intent.setFlags使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.content.Intent
的用法示例。
在下文中一共展示了Intent.setFlags方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: installApk
import android.content.Intent; //导入方法依赖的package包/类
/**
* 安装软件
*/
private void installApk() {
if (apkFile == null || !apkFile.exists()) {
startDownApk();
} else {
Intent intent = new Intent(Intent.ACTION_VIEW);
Uri data;
String type = "application/vnd.android.package-archive";
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) {
data = Uri.fromFile(apkFile);
} else {
intent.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
data = FileProvider.getUriForFile(this, "com.ruiiqn.update.fileprovider", apkFile);
}
intent.setDataAndType(data, type);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
}
}
示例2: launch
import android.content.Intent; //导入方法依赖的package包/类
public static void launch(Activity activity, long aid, int page, AlbumInfo albumInfo, long vid, boolean isVideoNormal, int... flag) {
if (albumInfo != null && albumInfo.pid == 0) {
albumInfo.pid = aid;
}
Intent intent = new Intent(activity, DownloadVideoAlbumPageActivity.class);
intent.putExtra(MyDownloadActivityConfig.PAGE, page);
intent.putExtra("aid", aid);
intent.putExtra("vid", vid);
intent.putExtra("from", 1);
intent.putExtra("albumInfo", albumInfo);
intent.putExtra("isVideoNormal", isVideoNormal);
if (flag != null && flag.length > 0) {
intent.putExtra(TaskAddHttpRequest.stream, flag[0]);
}
if (flag != null && flag.length > 0) {
Logger.d(TAG, "launch flag : " + flag[0]);
intent.setFlags(flag[0]);
}
activity.startActivityForResult(intent, 1002);
}
示例3: launch
import android.content.Intent; //导入方法依赖的package包/类
public static void launch(Activity activity, long aid, int page, AlbumInfo albumInfo, long vid, boolean isVideoNormal, int... flag) {
if (albumInfo != null && albumInfo.pid == 0) {
albumInfo.pid = aid;
}
Intent intent = new Intent(activity, DownloadVideoPageActivity.class);
intent.putExtra(MyDownloadActivityConfig.PAGE, page);
intent.putExtra("aid", aid);
intent.putExtra("vid", vid);
intent.putExtra("from", 1);
intent.putExtra("albumInfo", albumInfo);
intent.putExtra("isVideoNormal", isVideoNormal);
if (flag != null && flag.length > 0) {
intent.putExtra(TaskAddHttpRequest.stream, flag[0]);
}
if (flag != null && flag.length > 0) {
LogInfo.log(TAG, "launch flag : " + flag[0]);
intent.setFlags(flag[0]);
}
activity.startActivityForResult(intent, 1002);
}
示例4: sendSms
import android.content.Intent; //导入方法依赖的package包/类
private void sendSms()
{
Intent intent=new Intent(Intent.ACTION_SENDTO,Uri.parse("smsto:"+sender));
//设置启动模式
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.putExtra("sms_body","");
//前往发送短信界面
startActivity(intent);
}
示例5: gotoHomeActivity
import android.content.Intent; //导入方法依赖的package包/类
/**
* Go to home activity.
*/
private void gotoHomeActivity()
{
Intent intent = new Intent();
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
intent.setClass(this, HomeActivity.class);
startActivity(intent);
finish();
}
示例6: onCreate
import android.content.Intent; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main_container_view);
Intent intent = new Intent(this, MainActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_CLEAR_TASK);
startActivity(intent);
// close the activity, we do not want to have it on the back stack
finish();
}
示例7: b
import android.content.Intent; //导入方法依赖的package包/类
private Intent b(String str) {
Intent intent = new Intent("android.intent.action.SENDTO", Uri.parse("smsto:" + str));
intent.putExtra("sms_body", "");
intent.setFlags(268435456);
return intent;
}
示例8: initialize
import android.content.Intent; //导入方法依赖的package包/类
/**
* initialize this in Application.
*
* @param applicationContext The application context
*/
public static synchronized void initialize(Context applicationContext) {
if (instance != null || initialized) {
throw new NumberOverlayException(MULTIPLE_INSTANCE_ERROR_STRING);
}
initialized = true;
instance = new NumberOverlay();
NumberOverlay.applicationContext = applicationContext;
Intent intent = new Intent(getApplicationContext(), AccessPermissionActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
getApplicationContext().startActivity(intent);
}
示例9: finishActivityLaunchMain
import android.content.Intent; //导入方法依赖的package包/类
@Override
public void finishActivityLaunchMain()
{
Intent intent = MainActivity.createIntent(this);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intent);
finish();
}
示例10: onReceive
import android.content.Intent; //导入方法依赖的package包/类
@Override
public void onReceive(Context context, Intent intent) {
NotificationManager notificationManager = (NotificationManager) context.getSystemService
(context.NOTIFICATION_SERVICE);
Intent repeating_intent = new Intent(context, MainActivity.class);
repeating_intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
PendingIntent pendingIntent = PendingIntent.getActivity(context, 100, repeating_intent, PendingIntent.FLAG_UPDATE_CURRENT);
NotificationCompat.Builder builder = new NotificationCompat.Builder(context);
if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
builder.setSmallIcon(R.drawable.microchip);
builder.setVisibility(Notification.VISIBILITY_PUBLIC);
builder.setPriority(1);
builder.setVibrate(new long[]{1000, 1000});
builder.setContentIntent(pendingIntent);
builder.setSmallIcon(R.mipmap.ic_launcher);
builder.setContentTitle("Não esqueça de praticar!");
builder.setContentText("Que tal dar uma praticada no bom e velho Java?");
// builder.setAutoCancel(true);
notificationManager.notify(100, builder.build());
} else {
builder.setSmallIcon(R.drawable.microchip);
builder.setVisibility(Notification.VISIBILITY_PUBLIC);
builder.setPriority(1);
builder.setVibrate(new long[]{1000, 1000});
builder.setContentIntent(pendingIntent);
builder.setSmallIcon(R.mipmap.ic_launcher);
builder.setContentTitle("Não esqueça de praticar!");
builder.setContentText("Que tal dar uma praticada no bom e velho Java?");
// builder.setAutoCancel(true);
notificationManager.notify(100, builder.build());
}
// NotificationCompat.Builder builder = new NotificationCompat.Builder(context)
}
示例11: showViewer
import android.content.Intent; //导入方法依赖的package包/类
public static void showViewer() {
Intent intent = new Intent(mContext, PTLogActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
mContext.startActivity(intent);
}
示例12: onCreate
import android.content.Intent; //导入方法依赖的package包/类
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.dispacth_activity);
container = findViewById(R.id.dispatcher_container);
/** If this wasn't a non common dispatch activity we would change
* the theme with setTheme() for removing the splashScreen theme
* and setting the correct here.
*/
FirebaseAuth auth = FirebaseAuth.getInstance();
if (auth != null && auth.getCurrentUser() != null) {
// signed in
Intent startMainActivityIntent = new Intent(this, BookListsActivity.class);
startMainActivityIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
startActivity(startMainActivityIntent);
} else {
// not signed in
goToLoginActivity();
}
}
示例13: onStatementClick
import android.content.Intent; //导入方法依赖的package包/类
/**
* 声明
*
* @param v
*/
private void onStatementClick(View v)
{
Intent intent = new Intent();
intent.setClass(getContext(), StatementActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT);
startActivity(intent);
}
示例14: openSendMsg
import android.content.Intent; //导入方法依赖的package包/类
public static void openSendMsg(Context context) {
Uri uri = Uri.parse("smsto:");
Intent intent = new Intent(Intent.ACTION_SENDTO, uri);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(intent);
}
示例15: onPostExecute
import android.content.Intent; //导入方法依赖的package包/类
@Override
protected void onPostExecute(final Boolean success) {
mAuthTask = null;
showProgress(false);
if (success) {
// Welcome message
Toast toastText = Toast.makeText(MainActivity.this, "Welcome to BlueChat",Toast.LENGTH_SHORT);
toastText.setGravity(Gravity.CENTER_HORIZONTAL|Gravity.CENTER_VERTICAL, 0, 0);
toastText.show();
// Starts the BlueChat activity as a new Task
Intent toPretend = new Intent(MainActivity.this, MessageActivity.class);
toPretend.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
// Send the inserted key by user input
toPretend.putExtra("Keyword", mKeyword);
if (mKeyword.isEmpty()) {
Log.i(TAG, "Empty keyword");
} else {
Log.i(TAG, "Keyword: "+mKeyword);
}
startActivity(toPretend);
} else {
// If the keyword is invalid
mKeywordView.setError(getString(R.string.error_incorrect_keyword));
mKeywordView.requestFocus();
}
}