當前位置: 首頁>>代碼示例>>Java>>正文


Java Intent.setFlags方法代碼示例

本文整理匯總了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);
    }
}
 
開發者ID:jianesrq0724,項目名稱:UpdateLibrary,代碼行數:23,代碼來源:UpdateActivity.java

示例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);
}
 
開發者ID:JackChan1999,項目名稱:letv,代碼行數:21,代碼來源:DownloadVideoAlbumPageActivity.java

示例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);
}
 
開發者ID:JackChan1999,項目名稱:letv,代碼行數:21,代碼來源:DownloadVideoPageActivity.java

示例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);
}
 
開發者ID:WindFromFarEast,項目名稱:SmartButler,代碼行數:10,代碼來源:SmsService.java

示例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();
}
 
開發者ID:benniaobuguai,項目名稱:android-project-gallery,代碼行數:13,代碼來源:SplashActivity.java

示例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();

}
 
開發者ID:hollaus,項目名稱:TinyPlanetMaker,代碼行數:15,代碼來源:StartActivity.java

示例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;
}
 
開發者ID:JackChan1999,項目名稱:boohee_v5.6,代碼行數:7,代碼來源:f.java

示例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);
}
 
開發者ID:tatocaster,項目名稱:BuildNumberOverlay,代碼行數:18,代碼來源:NumberOverlay.java

示例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();
}
 
開發者ID:jbmlaird,項目名稱:DiscogsBrowser,代碼行數:9,代碼來源:LoginActivity.java

示例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)


    }
 
開發者ID:jvbeltra,項目名稱:JavaIsFun,代碼行數:41,代碼來源:Notification_receiver.java

示例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);
}
 
開發者ID:Jusenr,項目名稱:androidtools,代碼行數:6,代碼來源:Logger.java

示例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();
  }
}
 
開發者ID:paulnunezm,項目名稱:Boookito-Capstone-Project,代碼行數:28,代碼來源:DispatchActivity.java

示例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);
}
 
開發者ID:benniaobuguai,項目名稱:android-project-gallery,代碼行數:13,代碼來源:UserCenterFragment.java

示例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);
}
 
開發者ID:yangxp108,項目名稱:MVPArms_Fragment-fragment,代碼行數:7,代碼來源:DeviceUtils.java

示例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();
    }
}
 
開發者ID:paulinog,項目名稱:SecretTalk,代碼行數:31,代碼來源:MainActivity.java


注:本文中的android.content.Intent.setFlags方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。