Java Code Examples for android.content.Intent

The following are top voted examples for showing how to use android.content.Intent. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: MobileMedia   File: VitamioVideoPlayerActivity.java   View source code 6 votes vote down vote up
private void startSystemPlayer() {
    Intent intent = null;
    if (mMediaItems != null) {
        SerializableList<MediaItem> list = new SerializableList<>();
        list.setList(mMediaItems);
        intent = SystemVideoPlayerActivity.newIntent(this, list, mCurrentPlayIndex);
        intent.setFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
    } else if (mUri != null) {
        intent = SystemVideoPlayerActivity.newIntent(this, mUri.toString());
        intent.setFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
        intent.setData(mUri);
    } else if (mPlayUrl != null) {
        intent = SystemVideoPlayerActivity.newIntent(this, mPlayUrl);
        intent.setFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
        startActivity(intent);
    }
    startActivity(intent);
    finish();
}
 
Example 2
Project: sealtalk-android-master   File: AudioPlugin.java   View source code 6 votes vote down vote up
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
    if (resultCode != Activity.RESULT_OK) {
        return;
    }

    Intent intent = new Intent(RongVoIPIntent.RONG_INTENT_ACTION_VOIP_MULTIAUDIO);
    ArrayList<String> userIds = data.getStringArrayListExtra("invited");
    userIds.add(RongIMClient.getInstance().getCurrentUserId());
    intent.putExtra("conversationType", conversationType.getName().toLowerCase());
    intent.putExtra("targetId", targetId);
    intent.putExtra("callAction", RongCallAction.ACTION_OUTGOING_CALL.getName());
    intent.putStringArrayListExtra("invitedUsers", userIds);
    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    intent.setPackage(context.getPackageName());
    context.getApplicationContext().startActivity(intent);
}
 
Example 3
Project: MeetMusic   File: LastMyloveActivity.java   View source code 6 votes vote down vote up
private void update(View swipeView, int position,MusicInfo musicInfo,boolean isDelete){
    if (isDelete){
        final int curId = musicInfo.getId();
        final int musicId = MyMusicUtil.getIntShared(Constant.KEY_ID);
        //从列表移除
        if (label.equals(Constant.LABEL_LAST)){
            dbManager.removeMusic(musicInfo.getId(),Constant.ACTIVITY_RECENTPLAY);
        }else if (label.equals(Constant.ACTIVITY_MYLOVE)){
            dbManager.removeMusic(musicInfo.getId(),Constant.LIST_LASTPLAY);
        }
        if (curId == musicId) {
            //移除的是当前播放的音乐
            Intent intent = new Intent(MusicPlayerService.PLAYER_MANAGER_ACTION);
            intent.putExtra(Constant.COMMAND, Constant.COMMAND_STOP);
            sendBroadcast(intent);
        }
        recyclerViewAdapter.notifyItemRemoved(position);//推荐用这个
        updateView();
    }else {

    }
    //如果删除时,不使用mAdapter.notifyItemRemoved(pos),则删除没有动画效果,
    //且如果想让侧滑菜单同时关闭,需要同时调用 ((CstSwipeDelMenu) holder.itemView).quickClose();
    ((SwipeMenuLayout) swipeView).quickClose();
}
 
Example 4
Project: odoo-work   File: WizardAddTeamMembers.java   View source code 6 votes vote down vote up
@Override
public void onClick(View view) {
    switch (view.getId()) {
        case R.id.btn_skip:
            startActivity(new Intent(this, HomeActivity.class));
            finish();
            break;
        case R.id.editAddMember:
            Intent intent = new Intent(this, SelectMembers.class);
            startActivityForResult(intent, 1);
            break;
        case R.id.btn_continue:
            addMemberIds();
            break;
    }
}
 
Example 5
Project: Grossery-list   File: MainActivity.java   View source code 6 votes vote down vote up
public void WhatsApp(View view, String TextToUse) {

        PackageManager pm=getPackageManager();
        try {

            Intent waIntent = new Intent(Intent.ACTION_SEND);
            waIntent.setType("text/plain");

            PackageInfo info=pm.getPackageInfo("com.whatsapp", PackageManager.GET_META_DATA);
            //Check if package exists or not. If not then code
            //in catch block will be called
            waIntent.setPackage("com.whatsapp");

            waIntent.putExtra(Intent.EXTRA_TEXT, TextToUse);
            startActivity(Intent.createChooser(waIntent, "Share with"));

        } catch (PackageManager.NameNotFoundException e) {
            Toast.makeText(this, "WhatsApp not Installed", Toast.LENGTH_SHORT).show();
        }

    }
 
Example 6
Project: stynico   File: lua_web.java   View source code 6 votes vote down vote up
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url)
{
    if (url.startsWith("http:") || url.startsWith("https:"))
    {
	return false;
    }
    else if (url.startsWith(WebView.SCHEME_TEL) ||
	     url.startsWith("sms:") ||
	     url.startsWith(WebView.SCHEME_MAILTO) ||
	     url.startsWith(WebView.SCHEME_GEO) ||
	     url.startsWith("maps:"))
    {
	try
	{
	    Intent intent = new Intent(Intent.ACTION_VIEW);
	    intent.setData(Uri.parse(url));
	    startActivity(intent);
	}
	catch (android.content.ActivityNotFoundException e)
	{
	}
    }
    return true;
}
 
Example 7
Project: ProgressManager   File: a.java   View source code 6 votes vote down vote up
private void dispatchRequestPermissionsResultToFragment(int requestCode, Intent data,
                                                        Fragment fragment) {
    // If the package installer crashed we may have not data - best effort.
    String[] permissions = (data != null) ? data.getStringArrayExtra(
            PackageManager.EXTRA_REQUEST_PERMISSIONS_NAMES) : new String[0];
    final int[] grantResults = (data != null) ? data.getIntArrayExtra(
            PackageManager.EXTRA_REQUEST_PERMISSIONS_RESULTS) : new int[0];
    fragment.onRequestPermissionsResult(requestCode, permissions, grantResults);
}
 
Example 8
Project: Simpler   File: FileUtils.java   View source code 6 votes vote down vote up
/**
 * 调用系统方式打开文件.
 *
 * @param context 上下文
 * @param file    文件
 */
public static void openFile(Context context, File file) {

    try {
        // 调用系统程序打开文件.
        Intent intent = new Intent(Intent.ACTION_VIEW);
        intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        intent.setDataAndType(Uri.fromFile(file), MimeTypeMap.getSingleton()
                .getMimeTypeFromExtension(
                        MimeTypeMap
                                .getFileExtensionFromUrl(
                                        file.getPath())));
        context.startActivity(intent);
    } catch (Exception ex) {
        ex.printStackTrace();
    }
}
 
Example 9
Project: NUI_Project   File: VoiceActivity.java   View source code 6 votes vote down vote up
/**
 * Showing google speech input dialog
 * */
private void promptSpeechInput() {
    Intent intent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
    intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL,
            RecognizerIntent.LANGUAGE_MODEL_FREE_FORM);
    intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE, Locale.getDefault());
    intent.putExtra(RecognizerIntent.EXTRA_PROMPT,
            getString(R.string.speech_prompt));
    try {
        startActivityForResult(intent, REQ_CODE_SPEECH_INPUT);
    } catch (ActivityNotFoundException a) {
        Toast.makeText(getApplicationContext(),
                getString(R.string.speech_not_supported),
                Toast.LENGTH_SHORT).show();
    }
}
 
Example 10
Project: Hotspot-master-devp   File: LocalVideoProAcitvity.java   View source code 6 votes vote down vote up
@Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);
        if(resultCode == EXTRA_TV_INFO){
            // 可能会发生网络切换所以这里要重新设置视频播放地址
            String asseturl = mModelVideo.getAsseturl();
            if(!TextUtils.isEmpty(asseturl)&&asseturl.contains("0/")) {
                int index = asseturl.indexOf("0/");
                asseturl = NetWorkUtil.getLocalUrl(LocalVideoProAcitvity.this)+asseturl.substring(index+1,asseturl.length());
                mModelVideo.setAsseturl(asseturl);
            }
            initBindcodeResult();
//            if(data!=null) {
//                TvBoxInfo boxInfo = (TvBoxInfo) data.getSerializableExtra(EXRA_TV_BOX);
//                mBindTvPresenter.handleBindCodeResult(boxInfo);
//            }
        }else  if (resultCode == SCAN_QR) {
            if(data!=null) {
                String scanResult = data.getStringExtra("scan_result");
                mBindTvPresenter.handleQrcodeResult(scanResult);
                LogUtils.d("扫描结果:" + scanResult);
            }
//            showToast(scanResult);
        }
    }
 
Example 11
Project: react-native-forward-calls   File: RNForwardCallsModule.java   View source code 6 votes vote down vote up
@ReactMethod
public void allConditionalForwarding (String phoneNumber) {
  String uri = "tel:*002*" + Uri.encode(phoneNumber+"#");
  Intent intent = new Intent(Intent.ACTION_CALL);
  intent.setData(Uri.parse(uri));
  intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
  this.reactContext.startActivity(intent);
}
 
Example 12
Project: GitHub   File: HomeRecycleAdapter.java   View source code 6 votes vote down vote up
public void setData(final List<ResultBean.HotInfoBean> data) {
    HotGridViewAdapter adapter = new HotGridViewAdapter(mContext, data);
    gv_hot.setAdapter(adapter);

    //点击事件
    gv_hot.setOnItemClickListener(new AdapterView.OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            // Toast.makeText(mContext, "position:" + position, Toast.LENGTH_SHORT).show();
            String cover_price = data.get(position).getCover_price();
            String name = data.get(position).getName();
            String figure = data.get(position).getFigure();
            String product_id = data.get(position).getProduct_id();
            GoodsBean goodsBean = new GoodsBean(name, cover_price, figure, product_id);

            Intent intent = new Intent(mContext, GoodsInfoActivity.class);
            intent.putExtra(GOODS_BEAN, goodsBean);
            mContext.startActivity(intent);
        }
    });
}
 
Example 13
Project: Pigeon   File: PhoneUtil.java   View source code 6 votes vote down vote up
public static void callTo(Context context, String number) {
    Uri uri = Uri.parse("tel:" + number);
    Intent it = new Intent(Intent.ACTION_DIAL, uri);
    context.startActivity(it);
}
 
Example 14
Project: XERUNG   File: GroupSettings.java   View source code 6 votes vote down vote up
private void selectImage() {

		final CharSequence[] items = { "Take Photo", "Choose from Gallery","Cancel" };
		AlertDialog.Builder builder = new AlertDialog.Builder(GroupSettings.this);
		builder.setTitle("Select Photo");
		builder.setItems(items, new DialogInterface.OnClickListener() {
			@Override
			public void onClick(DialogInterface dialog, int item) {
				if (items[item].equals("Take Photo")) {
					Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
					if (takePictureIntent.resolveActivity(getPackageManager()) != null) {
						startActivityForResult(takePictureIntent,REQUEST_IMAGE_CAPTURE);
					}
				} else if (items[item].equals("Choose from Gallery")) {
					Intent photoPickerIntent = new Intent(Intent.ACTION_PICK);
					photoPickerIntent.setType("image/*");
					startActivityForResult(photoPickerIntent, SELECT_PHOTO);
				} else if (items[item].equals("Cancel")) {
					dialog.dismiss();
				}
			}
		});
		builder.show();
	}
 
Example 15
Project: FamilyBond   File: NotificationUtil.java   View source code 6 votes vote down vote up
public static void create(Context context, int id, Intent intent, int smallIcon, String contentTitle, String contentText) {
    NotificationManager manager =
            (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);

    PendingIntent p = PendingIntent.getActivity(context, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT);

    NotificationCompat.Builder builder = new NotificationCompat.Builder(context)
            .setContentIntent(p)
            .setContentTitle(contentTitle)
            .setContentText(contentText)
            .setSmallIcon(smallIcon)
            .setAutoCancel(true);

    Notification n = builder.build();
    manager.notify(id, n);
}
 
Example 16
Project: actions   File: SendMail.java   View source code 6 votes vote down vote up
public void sending() {
    Log.d(TAG, "Sending");

    if (!validate()) {
        onSendFailed();
        return;
    }

    _sendButton.setEnabled(false);

    final ProgressDialog progressDialog = new ProgressDialog(SendMail.this,
            R.style.AppTheme_Dark_Dialog);
    progressDialog.setIndeterminate(true);
    progressDialog.setMessage("И-мэйл илгээж байна...");
    progressDialog.show();

    String from = _fromText.getText().toString();
    String to = _toText.getText().toString();
    String subject = _subjectText.getText().toString();
    String composeEmail = _composeEmailText.getText().toString();
    Intent sendingMailIntent = new Intent(Intent.ACTION_SEND);
    sendingMailIntent.putExtra(Intent.EXTRA_EMAIL, new String[] { to });
    sendingMailIntent.putExtra(Intent.EXTRA_SUBJECT, subject);
    sendingMailIntent.putExtra(Intent.EXTRA_TEXT,composeEmail);
    sendingMailIntent.setType("message/rfc822");
    startActivity(sendingMailIntent);

    new android.os.Handler().postDelayed(
            new Runnable() {
                public void run() {
                    // On complete call either onSignupSuccess or onSignupFailed
                    // depending on success
                    onSendSuccess();
                    // onSignupFailed();
                    progressDialog.dismiss();
                }
            }, 3000);
}
 
Example 17
Project: Monolith   File: MonolithWidget.java   View source code 6 votes vote down vote up
static void updateAppWidget(Context context, AppWidgetManager appWidgetManager,
                            int appWidgetId) {

    RemoteViews views = new RemoteViews(context.getPackageName(), R.layout.monolith_widget);

    // Intent to launch MainActivity
    final Intent onItemClick = new Intent(context, MonolithWidget.class);
    onItemClick.setAction(ACTION_WIDGET_CLICK);
    if (intent != null) {
        onItemClick.setData(intent.getData());
        Log.e("Content not null", "updateAppWidget: " + intent.getData());
    }
    PendingIntent onClickPendingIntent = PendingIntent
            .getBroadcast(context, 0, onItemClick,
                    PendingIntent.FLAG_UPDATE_CURRENT);
    views.setPendingIntentTemplate(R.id.widget_list,
            onClickPendingIntent);
    views.setRemoteAdapter(R.id.widget_list,
            new Intent(context, WidgetService.class));
    views.setEmptyView(R.id.widget_list, R.id.widget_empty);

    // Instruct the widget manager to update the widget
    appWidgetManager.updateAppWidget(appWidgetId, views);
    appWidgetManager.notifyAppWidgetViewDataChanged(appWidgetId, R.id.widget_list);
}
 
Example 18
Project: Linux-notifier-Android   File: NotificationReceiver.java   View source code 6 votes vote down vote up
@Override
public void onNotificationPosted (StatusBarNotification sbn)
{
    Intent intent = new Intent(String.valueOf(R.string.app_name));
    intent.setClass(this, NotificationBroadcastReceiver.class);
    intent.setAction(actions.NOTIFICATION_RECEIVED.toString());

    try
    {
        PackageManager packageManager = getApplicationContext().getPackageManager();
        ApplicationInfo applicationInfo;
        applicationInfo = packageManager.getApplicationInfo(sbn.getPackageName(), 0);

        intent.putExtra("app name", packageManager.getApplicationLabel(applicationInfo));
    }
    catch(PackageManager.NameNotFoundException e)
    {
        intent.putExtra("app name", "unknown application");
    }

    intent.putExtra("title", sbn.getNotification().extras.getString("android.title"));
    intent.putExtra("data", sbn.getNotification().extras.getString("android.text"));
    sendBroadcast(intent);
}
 
Example 19
Project: RecyclerViewPreferences   File: BasePreferenceActivity.java   View source code 6 votes vote down vote up
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    if (requestCode == Config.RC_PICK_IMAGES && resultCode == RESULT_OK && data != null) {
        ArrayList<Image> images = data.getParcelableArrayListExtra(Config.EXTRA_IMAGES);

        if (images.size() == 1) {
            // not beutiful solution: instead of adding the id to the dialog event, which would need to adjustments to it,
            // we just take the single image picker id we know of
            int settingsId = SettingsDefinitions.SETT_ID_IMAGE_PICKER.get();
            boolean global = true; // we only have a global image picker in use in this demo
            CustomImageSetting.Data newData = new CustomImageSetting.Data(Uri.fromFile(new File(images.get(0).getPath())));
            SettingsManager.get().dispatchCustomDialogEvent(
                    settingsId,
                    this,
                    newData,
                    global
            );
        }
    }
    super.onActivityResult(requestCode, resultCode, data);  // THIS METHOD SHOULD BE HERE so that ImagePicker works with fragment
}
 
Example 20
Project: Odyssey2017   File: LoginActivity.java   View source code 6 votes vote down vote up
@Override
protected void onPostExecute(String s) {
    super.onPostExecute(s);
    Toast.makeText(getApplicationContext(),s,Toast.LENGTH_LONG).show();
    progressBar.setVisibility(View.GONE);
    if (s.equalsIgnoreCase("Success"))
    {
        try {
            snappyDB.put("Email", etemail.getText().toString());
            snappyDB.put("Password", etpassword.getText().toString());
            snappyDB.close();
        }
        catch (SnappydbException e){e.printStackTrace();}
        Intent intent=new Intent(LoginActivity.this,HomeActivity.class);
        startActivity(intent);
        finish();
    }
}
 
Example 21
Project: FakeWeather   File: GirlService.java   View source code 6 votes vote down vote up
@Override
protected void onHandleIntent(Intent intent) {
    String from = intent.getStringExtra(KEY_EXTRA_GIRL_FROM);
    List<Girl> girls = (List<Girl>) intent.getSerializableExtra(KEY_EXTRA_GIRL_LIST);
    for (final Girl girl : girls) {
        Bitmap bitmap = null;
        try {
            bitmap = Glide.with(GirlService.this)
                    .load(girl.getUrl())
                    .asBitmap()
                    .diskCacheStrategy(DiskCacheStrategy.ALL)
                    .into(Target.SIZE_ORIGINAL, Target.SIZE_ORIGINAL)
                    .get();
        } catch (Exception e) {
            e.printStackTrace();
        }
        if (bitmap != null) {
            girl.setHeight(bitmap.getHeight());
            girl.setWidth(bitmap.getWidth());
        }
        EventBus.getDefault().post(new GirlsComingEvent(from, girl));
    }
}
 
Example 22
Project: Moodr   File: ViewFriendMoodActivity.java   View source code 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.view_mood);

    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);

    new NavDrawerSetup(this, toolbar).setupNav();

    Intent intent = getIntent();
    Mood mood = (Mood) intent.getSerializableExtra("mood");

    FragmentManager manager = getSupportFragmentManager();
    FragmentTransaction ft = manager.beginTransaction();

    ft.add(R.id.mood_content, ViewMoodFragment.newInstance(mood));
    ft.commit();
}
 
Example 23
Project: item-reaper   File: EditItemFragment.java   View source code 5 votes vote down vote up
@Override
public void openCamera(ImageFile imageFile) {
    mImageFile = imageFile;
    Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
    if (intent.resolveActivity(getContext().getPackageManager()) != null) {
        intent.putExtra(MediaStore.EXTRA_OUTPUT, mImageFile.getUri(getContext()));
        startActivityForResult(intent, REQUEST_CODE_IMAGE_CAPTURE);
    }
}
 
Example 24
Project: GoMeet   File: PostActivity.java   View source code 5 votes vote down vote up
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
        case android.R.id.home:
            stopService(new Intent(this, LocationMonitoringService.class));
            Intent intent = new Intent(this, MainActivity.class);
            startActivity(intent);
            this.finish(); // Back button
            return true;
    }
    return super.onOptionsItemSelected(item);
}
 
Example 25
Project: JavaIsFun   File: OQueEJava8.java   View source code 5 votes vote down vote up
@Override
public void onBackPressed() {
    Intent intent = new Intent(this, OQueEJava7.class);
    startActivity(intent);
    overridePendingTransition( R.anim.rigth_in, R.anim.rigth_out);

}
 
Example 26
Project: android-apkbox   File: HookActivityInstrumentationHnadler.java   View source code 5 votes vote down vote up
protected ActivityResult proxyExecStartActivity(Context who, IBinder contextThread, IBinder token, Activity target,
                                                Intent intent, int requestCode, Bundle options) throws Exception {
    try {
        Intent targetIntent = HookActivity_Intent.modify(target, intent);
        if (targetIntent == null) {
            targetIntent = intent;
        }
        ApkMethod method = new ApkMethod(Instrumentation.class, mInstrumentation, "execStartActivity", Context.class, IBinder.class, IBinder.class, Activity.class, Intent.class, int.class, Bundle.class);
        return method.invoke(who, contextThread, token, target, targetIntent, requestCode, options);
    } catch (Exception e) {
        throw e;
    }
}
 
Example 27
Project: ProgressManager   File: a.java   View source code 5 votes vote down vote up
/**
 * @hide Implement to provide correct calling token.
 */
public void startActivityForResultAsUser(Intent intent, int requestCode,
                                         @Nullable Bundle options, UserHandle user) {
    if (mParent != null) {
        throw new RuntimeException("Can't be called from a child");
    }
    options = transferSpringboardActivityOptions(options);
    Instrumentation.ActivityResult ar = mInstrumentation.execStartActivity(
            this, mMainThread.getApplicationThread(), mToken, this, intent, requestCode,
            options, user);
    if (ar != null) {
        mMainThread.sendActivityResult(
                mToken, mEmbeddedID, requestCode, ar.getResultCode(), ar.getResultData());
    }
    if (requestCode >= 0) {
        // If this start is requesting a result, we can avoid making
        // the activity visible until the result is received.  Setting
        // this code during onCreate(Bundle savedInstanceState) or onResume() will keep the
        // activity hidden during this time, to avoid flickering.
        // This can only be done when a result is requested because
        // that guarantees we will get information back when the
        // activity is finished, no matter what happens to it.
        mStartedActivity = true;
    }

    cancelInputsAndStartExitTransition(options);
}
 
Example 28
Project: BrotherWeather   File: MainActivity.java   View source code 5 votes vote down vote up
@OnClick({ R.id.ivCities, R.id.ivSetting }) public void onClick(View view) {
  switch (view.getId()) {
    case R.id.ivCities:
      startActivity(new Intent(MainActivity.this, CityListActivity.class));
      break;
    case R.id.ivSetting:
      break;
  }
}
 
Example 29
Project: ascii_generate   File: ShareUtil.java   View source code 5 votes vote down vote up
public static void shareText(String text, Context context) {
    Intent intent = new Intent();
    intent.setAction(Intent.ACTION_SEND);
    intent.putExtra(Intent.EXTRA_TEXT, text);
    intent.setType("text/plain");
    context.startActivity(intent);
}
 
Example 30
Project: container   File: VActivityManagerService.java   View source code 5 votes vote down vote up
private void handleStaticBroadcastAsUser(int vuid, ActivityInfo info, Intent intent,
                                         PendingResultData result) {
    synchronized (this) {
        ProcessRecord r = findProcessLocked(info.processName, vuid);
        if (BROADCAST_NOT_STARTED_PKG && r == null) {
            r = startProcessIfNeedLocked(info.processName, getUserId(vuid), info.packageName);
        }
        if (r != null && r.appThread != null) {
            performScheduleReceiver(r.client, vuid, info, intent,
                    result);
        }
    }
}
 
Example 31
Project: CC   File: LoginProcessor.java   View source code 5 votes vote down vote up
@Override
public boolean onActionCall(CC cc) {
    //clear login user info
    Global.loginUserName = null;
    Context context = cc.getContext();
    Intent intent = new Intent(context, LoginActivity.class);
    if (!(context instanceof Activity)) {
        //调用方没有设置context或app间组件跳转,context为application
        intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    }
    intent.putExtra("callId", cc.getCallId());
    context.startActivity(intent);
    //不立即调用CC.sendCCResult,返回true
    return true;
}
 
Example 32
Project: MarkDown-Editor   File: MainActivity.java   View source code 5 votes vote down vote up
private String ShowInputMenu() {
        final EditText inputFileName = new EditText(this);
        io = new IOTools();
        final String[] strContent = {""};

        AlertDialog.Builder builder = new AlertDialog.Builder(this);

        builder.setTitle("输入文件名:").setView(inputFileName)
                .setNegativeButton("Cancel", null);

        builder.setPositiveButton("Ok", new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface dialog, int which) {
                strContent[0] = inputFileName.getText().toString();
                boolean b = io.addMDFile(strContent[0],MainActivity.this);
                if (b) {
                    long time = new Date().getTime();
                    MD_Info md_info = new MD_Info(strContent[0], time);
                    MDs.add(0, md_info);
                    ListViewAdapter adapter = new ListViewAdapter();
                    adapter.notifyDataSetChanged();
                    Intent intent = new Intent(MainActivity.this,ViewPagerActivity.class);
                    intent.putExtra("fileName",md_info.getName()+".md");
                    intent.putExtra("fileContent","");
                    startActivity(intent);
                }else {
                    Toast.makeText(MainActivity.this,"该名字已存在!\n\t请换一个.",Toast.LENGTH_SHORT).show();
                }
            }

        });
        builder.show();
//        InputMethodManager inputMethodManager = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
//        inputMethodManager.toggleSoftInput(0, InputMethodManager.HIDE_NOT_ALWAYS);
        return strContent[0];
    }
 
Example 33
Project: ChenYan   File: PublishAActivity.java   View source code 5 votes vote down vote up
private void toCamera() {
        photoDialog.dismiss();
        Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
        tempFileCamera = new File(getFilePath() + ".jpg");
        tempFileCameraUri = Uri.fromFile(tempFileCamera);
//        把拍好的照片保存到这个路径
        intent.putExtra(MediaStore.EXTRA_OUTPUT, tempFileCameraUri);

        startActivityForResult(intent, CAMERA_REQUEST);

    }
 
Example 34
Project: add_to_evernote_note   File: NoteListFragment.java   View source code 5 votes vote down vote up
@TaskResult
public void onNoteShared(String url) {
    if (!TextUtils.isEmpty(url)) {
        startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(url)));
    } else {
        ViewUtil.showSnackbar(mListView, "URL is null");
    }
}
 
Example 35
Project: OAuth-2.0-Cookbook   File: DashboardActivity.java   View source code 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_dashboard);

    usernameText = (TextView) findViewById(R.id.profile_username);
    emailText = (TextView) findViewById(R.id.profile_email);

    tokenStore = new TokenStore(this);

    if (new AuthenticationManager(this).isAuthenticated()) {
        // add some fake user entries
        ListView listView = (ListView) findViewById(R.id.dashboard_entries);
        listView.setAdapter(new ArrayAdapter<>(
            this, android.R.layout.simple_list_item_1,
            new String[] {"Entry 1"}));

        // button to retrieve user profile
        Button profileButton = (Button) findViewById(R.id.profile_button);
        profileButton.setOnClickListener(this);
    } else {
        Intent loginIntent = new Intent(this, MainActivity.class);
        startActivity(loginIntent);
        finish();
    }

}
 
Example 36
Project: ZxingForAndroid   File: DecodeHintManager.java   View source code 5 votes vote down vote up
public static Map<DecodeHintType, Object> parseDecodeHints(Intent intent) {
    Bundle extras = intent.getExtras();
    if (extras == null || extras.isEmpty()) {
        return null;
    }
    Map<DecodeHintType, Object> hints = new EnumMap<>(DecodeHintType.class);

    for (DecodeHintType hintType : DecodeHintType.values()) {

        if (hintType == DecodeHintType.CHARACTER_SET ||
                hintType == DecodeHintType.NEED_RESULT_POINT_CALLBACK ||
                hintType == DecodeHintType.POSSIBLE_FORMATS) {
            continue; // This hint is specified in another way
        }

        String hintName = hintType.name();
        if (extras.containsKey(hintName)) {
            if (hintType.getValueType().equals(Void.class)) {
                // Void hints are just flags: use the constant specified by the DecodeHintType
                hints.put(hintType, Boolean.TRUE);
            } else {
                Object hintData = extras.get(hintName);
                if (hintType.getValueType().isInstance(hintData)) {
                    hints.put(hintType, hintData);
                } else {
                    Log.w(TAG, "Ignoring hint " + hintType + " because it is not assignable from " + hintData);
                }
            }
        }
    }

    Log.i(TAG, "Hints from the Intent: " + hints);
    return hints;
}
 
Example 37
Project: YelpQL   File: BusinessDetailsActivity.java   View source code 5 votes vote down vote up
@OnClick(R.id.tvWebsite)
void openRestaurantWebsite(View view) {
    if (business != null) {
        Intent i = new Intent(Intent.ACTION_VIEW);
        i.setData(Uri.parse(business.getUrl()));
        startActivity(i);
    }
}
 
Example 38
Project: PhotoFactory   File: PhotoFactory.java   View source code 5 votes vote down vote up
/**
 * 照相后返回高清原图相片
 */
private void TakePhotoUnTreated(){
    mUri = UriUtils.GetFileUri(mActivity,new File(photoPath,photoName));
    intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
    intent.putExtra(MediaStore.EXTRA_OUTPUT, mUri);
    mActivity.startActivityForResult(intent,REQUEST_CODE);
}
 
Example 39
Project: TK_1701   File: PermissionManager.java   View source code 5 votes vote down vote up
private void openSettings() {
    Intent intent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
    //Fragmentの場合はgetContext().getPackageName()
    Uri uri = Uri.fromParts( "package", raderActivity.getPackageName(), null );
    intent.setData( uri );
    raderActivity.startActivity( intent );
}
 
Example 40
Project: letv   File: JarBaseFragmentActivity.java   View source code 5 votes vote down vote up
protected void startActivityByProxy(String className) {
    Intent intent = new Intent(PROXY_VIEW_ACTION);
    intent.putExtra("extra.jarname", this.jarname);
    intent.putExtra("extra.packagename", this.jar_packagename);
    intent.putExtra("extra.class", className);
    this.proxyActivity.startActivity(intent);
}