Java Code Examples for android.content.Intent.setFlags()

The following are Jave code examples for showing how to use setFlags() of the android.content.Intent class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: UpdateLibrary   File: UpdateActivity.java   View Source Code Vote up 7 votes
/**
 * 安装软件
 */
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);
    }
}
 
Example 2
Project: letv   File: DownloadVideoAlbumPageActivity.java   View Source Code Vote up 7 votes
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);
}
 
Example 3
Project: letv   File: DownloadVideoPageActivity.java   View Source Code Vote up 7 votes
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);
}
 
Example 4
Project: SmartButler   File: SmsService.java   View Source Code Vote up 6 votes
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);
}
 
Example 5
Project: android-project-gallery   File: SplashActivity.java   View Source Code Vote up 6 votes
/**
 * 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();
}
 
Example 6
Project: TinyPlanetMaker   File: StartActivity.java   View Source Code Vote up 6 votes
@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();

}
 
Example 7
Project: boohee_v5.6   File: f.java   View Source Code Vote up 6 votes
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;
}
 
Example 8
Project: BuildNumberOverlay   File: NumberOverlay.java   View Source Code Vote up 6 votes
/**
 * 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);
}
 
Example 9
Project: DiscogsBrowser   File: LoginActivity.java   View Source Code Vote up 6 votes
@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();
}
 
Example 10
Project: JavaIsFun   File: Notification_receiver.java   View Source Code Vote up 6 votes
@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)


    }
 
Example 11
Project: androidtools   File: Logger.java   View Source Code Vote up 6 votes
public static void showViewer() {
    Intent intent = new Intent(mContext, PTLogActivity.class);
    intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    mContext.startActivity(intent);
}
 
Example 12
Project: Boookito-Capstone-Project   File: DispatchActivity.java   View Source Code Vote up 6 votes
@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();
  }
}
 
Example 13
Project: android-project-gallery   File: UserCenterFragment.java   View Source Code Vote up 6 votes
/**
 * 声明
 * 
 * @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);
}
 
Example 14
Project: MVPArms_Fragment-fragment   File: DeviceUtils.java   View Source Code Vote up 6 votes
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);
}
 
Example 15
Project: SecretTalk   File: MainActivity.java   View Source Code Vote up 6 votes
@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();
    }
}
 
Example 16
Project: yyox   File: DeviceUtils.java   View Source Code Vote up 5 votes
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);
}
 
Example 17
Project: GitHub   File: SimpleGridActivity.java   View Source Code Vote up 5 votes
public static void startActivity(Activity activity) {
    Intent intent = new Intent(activity, SimpleGridActivity.class);
    intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
    activity.startActivity(intent);
}
 
Example 18
Project: FloatingNew   File: FloatingViewServiceOpen.java   View Source Code Vote up 5 votes
void startCloseService() {
    Intent intent = new Intent(FloatingViewServiceOpen.this, MyIntentService.class);
    intent.setFlags(2);
    stopForeground(true);
    startService(intent);
}
 
Example 19
Project: container   File: ResolverActivity.java   View Source Code Vote up 5 votes
private Intent makeMyIntent() {
    Intent intent = new Intent(getIntent());
    intent.setComponent(null);
    intent.setFlags(intent.getFlags() & ~Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);
    return intent;
}
 
Example 20
Project: sealtalk-android-master   File: UpdateService.java   View Source Code Vote up 5 votes
private static Intent webLauncher(String downloadUrl) {
    Uri download = Uri.parse(downloadUrl);
    Intent intent = new Intent(Intent.ACTION_VIEW, download);
    intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    return intent;
}