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

The following are Jave code examples for showing how to use putExtras() 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: boohee_v5.6   File: a.java   View Source Code Vote up 7 votes
public static boolean a(Context context, a aVar) {
    if (context == null || aVar == null) {
        com.tencent.mm.sdk.b.a.a("MicroMsg.SDK.MMessage", "send fail, invalid argument");
        return false;
    } else if (e.j(aVar.p)) {
        com.tencent.mm.sdk.b.a.a("MicroMsg.SDK.MMessage", "send fail, action is null");
        return false;
    } else {
        String str = null;
        if (!e.j(aVar.o)) {
            str = aVar.o + ".permission.MM_MESSAGE";
        }
        Intent intent = new Intent(aVar.p);
        if (aVar.n != null) {
            intent.putExtras(aVar.n);
        }
        String packageName = context.getPackageName();
        intent.putExtra(ConstantsAPI.SDK_VERSION, 570490883);
        intent.putExtra(ConstantsAPI.APP_PACKAGE, packageName);
        intent.putExtra(ConstantsAPI.CONTENT, aVar.m);
        intent.putExtra(ConstantsAPI.CHECK_SUM, b.a(aVar.m, 570490883, packageName));
        context.sendBroadcast(intent, str);
        com.tencent.mm.sdk.b.a.d("MicroMsg.SDK.MMessage", "send mm message, intent=" + intent
                + ", perm=" + str);
        return true;
    }
}
 
Example 2
Project: PlusGram   File: OpenChatReceiver.java   View Source Code Vote up 6 votes
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    Intent intent = getIntent();
    if (intent == null) {
        finish();
    }
    if (intent.getAction() == null || !intent.getAction().startsWith("com.tmessages.openchat")) {
        finish();
        return;
    }
    Intent intent2 = new Intent(this, LaunchActivity.class);
    intent2.setAction(intent.getAction());
    intent2.putExtras(intent);
    startActivity(intent2);
    finish();
}
 
Example 3
Project: Huochexing12306   File: FindPwdActivity.java   View Source Code Vote up 6 votes
@Override
public void onClick(View v) {
	switch(v.getId()){
	case R.id.email:
		Intent intentText = new Intent(this, EditTextAty.class);
		Bundle bundle = new Bundle();
		bundle.putString(EditTextAty.BAR_TITLE, "找回密码"); // EditAty的标题.
		bundle.putString(EditTextAty.INFO, ""); // EditTextAty中的tvInfo要显示的绑定信息。
		bundle.putBoolean(EditTextAty.INFO_READONLY, false); // tvInfo是否只读.
		bundle.putString(EditTextAty.REGEX, RegexUtils.regexEmail); // 验证合法的正则表达式,不需要则为空。
		bundle.putString(EditTextAty.ERROR_MSG, "邮箱格式不正确"); // 验证错误时要显示的文字.
		bundle.putString(EditTextAty.TIP, "请输入邮箱地址"); // 输入文本提示.
		bundle.putString(EditTextAty.OPERATE_TEXT, "确定"); // btnOperate显示文本.
		bundle.putString(EditTextAty.OPERATE, EditTextAty.OPERATE_FIND_PWD_BY_EMAIL); // btnOperate执行什么操作。
		bundle.putString(EditTextAty.OPERATE_ARGS, ""); // btnOperate具体操作参数。
		bundle.putSerializable(EditTextAty.OBJ, EmailNextActivity.class);
		intentText.putExtras(bundle);
		startActivity(intentText);
		break;
	}
}
 
Example 4
Project: Luhn   File: Luhn.java   View Source Code Vote up 6 votes
public void onScanPress(View v) {

        Intent scanIntent = new Intent(this, CardIOActivity.class);
        if (getIntent().hasExtra(CARD_IO)) {
            scanIntent.putExtras(getIntent().getBundleExtra(CARD_IO));
        } else {

            // customize these values to suit your needs.
            scanIntent.putExtra(CardIOActivity.EXTRA_REQUIRE_EXPIRY, true); // default: false
            scanIntent.putExtra(CardIOActivity.EXTRA_SCAN_EXPIRY, true); // default: false
            scanIntent.putExtra(CardIOActivity.EXTRA_REQUIRE_CVV, true); // default: false
            scanIntent.putExtra(CardIOActivity.EXTRA_REQUIRE_POSTAL_CODE, false); // default: false
            scanIntent.putExtra(CardIOActivity.EXTRA_USE_CARDIO_LOGO, true); // default: false
            scanIntent.putExtra(CardIOActivity.EXTRA_HIDE_CARDIO_LOGO, true); // default: false
            scanIntent.putExtra(CardIOActivity.EXTRA_SUPPRESS_MANUAL_ENTRY, true); // default: false
        }
        // MY_SCAN_REQUEST_CODE is arbitrary and is only used within this activity.
        startActivityForResult(scanIntent, CARDIO_REQUEST_ID);
    }
 
Example 5
Project: cniao5   File: SearchActivity.java   View Source Code Vote up 6 votes
private void doData(String content) {

        //有历史数据
        if (historySearchData != null && historySearchData.size() > 0) {
            for (int i = 0; i < historySearchData.size(); i++) {
                if (content.equals(historySearchData.get(i))) {
                    //有重复的
                    position = i;
                }
            }

            if (position != -1) {
                historySearchData.remove(position);
                historySearchData.add(0, content);
            } else {
                historySearchData.add(0, content);
            }

        } else {
            //没有历史数据
            historySearchData.add(content);
        }

        mHistorySearchAdapter.notifyDataSetChanged();
        String histortStr = new Gson().toJson(historySearchData);
        PreferencesUtils.putString(SearchActivity.this, "histortStr", histortStr);

        Bundle bundle = new Bundle();
        bundle.putString("search", content);
        Intent intent = new Intent(SearchActivity.this, SearchResultActivity.class);
        intent.putExtras(bundle);
        startActivity(intent);     //跳转到搜索结果界面

    }
 
Example 6
Project: ucar-weex-core   File: SchemaActivity.java   View Source Code Vote up 6 votes
@JSMethod
    public void push(String path, String param) {
        if ("nativeA".equals(path)) {
            Context context = (Activity) mWXSDKInstance.getContext();
            Intent intent = new Intent();
            intent.setClass(context, NativeActivity.class);
            Bundle bundle = new Bundle();
//            bundle.putString("param", param);
            intent.putExtras(bundle);
            context.startActivity(intent);
        }
    }
 
Example 7
Project: mDL-ILP   File: MainActivity.java   View Source Code Vote up 6 votes
@OnClick(R.id.main_18_share_icon)
public void transferAge18() {
    if (checkPerso()) {
        final Intent intent = new Intent(this, TransferLicenseActivity.class);
        Bundle b = new Bundle();
        b.putInt("age", 18);
        intent.putExtras(b);
        startActivity(intent);
    }
}
 
Example 8
Project: GitHub   File: ActivityUtils.java   View Source Code Vote up 6 votes
public void showActivityAnima(Activity aty, Class clazz, int flags, Bundle bundle, int inAnima, int outAnima) {
    Intent i = new Intent(aty, clazz);
    i.putExtras(bundle);
    i.setFlags(flags);
    aty.startActivity(i);
    aty.overridePendingTransition(inAnima, outAnima);
}
 
Example 9
Project: Programmers   File: CustomNotification.java   View Source Code Vote up 6 votes
private PendingIntent getCommentPendingIntent(Bundle b) {
    // Intent to open Comments Activity
    TaskStackBuilder stackBuilder = TaskStackBuilder.create(context);
    stackBuilder.addParentStack(CommentsActivity.class);

    Intent commentsIntent = IntentUtils.getIntent(context, CommentsActivity.class);
    commentsIntent.putExtras(b);
    stackBuilder.addNextIntent(commentsIntent);

    // Set the pendingIntent on Notification.Builder
    //PendingIntent pendingIntent = PendingIntent.getActivity(context, id, commentsIntent, PendingIntent.FLAG_UPDATE_CURRENT);
    return stackBuilder.getPendingIntent(0, PendingIntent.FLAG_UPDATE_CURRENT);
}
 
Example 10
Project: moebooru-android   File: PostSearchActivity.java   View Source Code Vote up 6 votes
@Override
public void onPostItemClick(int pos) {
    Bundle args = new Bundle();
    args.putInt(ARG_POST_ITEM_POS, pos);
    args.putString(ARG_POST_TYPE, "search");
    Intent intent = new Intent(this, PostDetailActivity.class);
    intent.putExtras(args);
    startActivity(intent);

}
 
Example 11
Project: qvod   File: BaseTitleActivity.java   View Source Code Vote up 5 votes
/**
 * [携带数据的页面跳转]
 *
 * @param clz
 * @param bundle
 */
public void startActivity(Class<?> clz, Bundle bundle) {
    Intent intent = new Intent();
    intent.setClass(this, clz);
    if (bundle != null) {
        intent.putExtras(bundle);
    }
    startActivity(intent);
}
 
Example 12
Project: shareNote   File: NoteActivity.java   View Source Code Vote up 5 votes
@Override
public void onItemClick(int position, View view) {
    Intent intent = new Intent(mContext, EditorActivity.class);
    TextView title = (TextView) view.findViewById(R.id.note_title);
    TextView content = (TextView) view.findViewById(R.id.note_content);
    Bundle bd = new Bundle();
    bd.putInt("class", 0x1);
    bd.putString("title", title.getText().toString());
    bd.putString("content", content.getText().toString());
    intent.putExtras(bd);
    startActivity(intent);
}
 
Example 13
Project: RLibrary   File: IntentUtils.java   View Source Code Vote up 5 votes
/**
 * 获取其他应用组件的意图
 *
 * @param packageName 包名
 * @param className   全类名
 * @param bundle      bundle
 * @return intent
 */
public static Intent getComponentIntent(String packageName, String className, Bundle bundle) {
    Intent intent = new Intent(Intent.ACTION_VIEW);
    if (bundle != null) intent.putExtras(bundle);
    ComponentName cn = new ComponentName(packageName, className);
    intent.setComponent(cn);
    return intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
}
 
Example 14
Project: Unofficial-Ups   File: CoursesFragment.java   View Source Code Vote up 5 votes
private void showCourseDetail(Bundle courseBundle){
    Intent i = new Intent(getActivity(),CourseDetailActivity.class);
    i.putExtras(courseBundle);
    startActivity(i);
}
 
Example 15
Project: PermissionsWrapper   File: RequestPermissionsActv.java   View Source Code Vote up 5 votes
private void sendGrantMessage() {
    Bundle args = new Bundle();
    args.putBoolean(Constants.GRANT, true);

    Intent intent = new Intent();
    intent.putExtras(args);
    intent.setAction(getPackageName());

    LocalBroadcastManager.getInstance(this).sendBroadcast(intent);
    finish();
}
 
Example 16
Project: AmenEye   File: TravelFragment.java   View Source Code Vote up 5 votes
@Override
public void onItemClick(int position, BaseItem data, View view) {
    //跳转到其他界面
    NewsBean topNews = (NewsBean) data.getData();
    Bundle bundle = new Bundle();
    Intent intent = new Intent(TravelFragment.this.getActivity(), TopNewsInfoActivity.class);
    bundle.putString(Constants.BUNDLE_KEY_TITLE, topNews.getTitle());
    bundle.putString(Constants.BUNDLE_KEY_ID, topNews.getDocid());
    bundle.putString(Constants.BUNDLE_KEY_IMG_URL, topNews.getImgsrc());
    intent.putExtras(bundle);
    String transitionName = getString(R.string.top_news_img);
    Pair pairImg = new Pair<>(view.findViewById(R.id.news_image), transitionName);
    ActivityOptionsCompat transitionActivityOptions = ActivityOptionsCompat.makeSceneTransitionAnimation(getActivity(), pairImg);
    startActivity(intent, transitionActivityOptions.toBundle());
}
 
Example 17
Project: JsoupSample   File: UIUtils.java   View Source Code Vote up 5 votes
public static void startActivity(@NonNull Class<?> clz, Bundle bundle) {
    Intent intent = new Intent(getContext(), clz);
    intent.putExtras(bundle);
    intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    getContext().startActivity(intent);
}
 
Example 18
Project: BilibiliClient   File: BangumiDetailsActivity.java   View Source Code Vote up 5 votes
public static void launch(Activity activity, int seasonId) {

    Intent mIntent = new Intent(activity, BangumiDetailsActivity.class);
    Bundle bundle = new Bundle();
    bundle.putInt(ConstantUtil.EXTRA_BANGUMI_KEY, seasonId);
    mIntent.putExtras(bundle);
    activity.startActivity(mIntent);
  }
 
Example 19
Project: tuxguitar   File: MainActivity.java   View Source Code Vote up 5 votes
private void testShowGtp(String filePath) {
    Uri gtpUri = Uri.parse("file://" + filePath);
    Intent intent = new Intent();
    intent.setData(gtpUri);

    Bundle bundle = new Bundle();
    bundle.putSerializable("title", "test");
    intent.putExtras(bundle);

    intent.setAction(Intent.ACTION_VIEW);
    intent.setClass(this, TGActivity.class);
    this.startActivity(intent);
}
 
Example 20
Project: easyfilemanager   File: NotificationUtils.java   View Source Code Vote up 5 votes
public static void createFtpNotification(Context context, Intent intent, int notification_id){
    RootInfo root = intent.getExtras().getParcelable(EXTRA_ROOT);
    if(null == root){
        return;
    }
    NotificationManager notificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);

    long when = System.currentTimeMillis();

    CharSequence contentTitle = getString(context,R.string.ftp_notif_title);
    CharSequence contentText = String.format(getString(context,R.string.ftp_notif_text),
            ConnectionUtils.getFTPAddress(context));
    CharSequence tickerText = getString(context, R.string.ftp_notif_starting);
    CharSequence stopText = getString(context,R.string.ftp_notif_stop_server);

    Intent notificationIntent = new Intent(context, DocumentsActivity.class);
    notificationIntent.setData(root.getUri());
    notificationIntent.putExtras(intent.getExtras());
    notificationIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
    PendingIntent contentIntent = PendingIntent.getActivity(context, 0, notificationIntent, 0);
    Intent stopIntent = new Intent(ACTION_STOP_FTPSERVER);
    stopIntent.putExtras(intent.getExtras());
    PendingIntent stopPendingIntent = PendingIntent.getBroadcast(context, 0,
            stopIntent, PendingIntent.FLAG_ONE_SHOT);

    NotificationCompat.Builder builder = new NotificationCompat.Builder(context)
            .setContentTitle(contentTitle)
            .setContentText(contentText)
            .setContentIntent(contentIntent)
            .setSmallIcon(R.drawable.ic_stat_server)
            .setTicker(tickerText)
            .setWhen(when)
            .setOngoing(true)
            .setColor(SettingsActivity.getPrimaryColor())
            .setVisibility(NotificationCompat.VISIBILITY_PUBLIC)
            .setCategory(NotificationCompat.CATEGORY_SERVICE)
            .setPriority(Notification.PRIORITY_MAX)
            .addAction(R.drawable.ic_action_stop, stopText, stopPendingIntent)
            .setShowWhen(false);

    Notification notification = builder.build();

    notificationManager.notify(notification_id, notification);
}