当前位置: 首页>>代码示例>>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;未经允许,请勿转载。