Intent putExtras - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Intent putExtras method.

This code example shows how to use the following methods:putExtras, putString
            } 
        } 
    } 
 
    private void scan(Context context, String volume) {
        Bundle args = new Bundle();
        args.putString("volume", volume);
        context.startService(
                new Intent(context, MediaScannerService.class).putExtras(args));
    }     
 
    private void scanFile(Context context, String path) {
        Bundle args = new Bundle();
        args.putString("filepath", path);
        context.startService(
                new Intent(context, MediaScannerService.class).putExtras(args));
    }     
} 
 
 
7
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:putExtras, setComponent, setFlags
         * binding any matching widgets to the corresponding targets. We can't 
         * bind ourselves because our parent process can't obtain the 
         * BIND_APPWIDGET permission. 
         */ 
        private void launchAppWidgetBinder(int[] bindSources, ArrayList<ComponentName> bindTargets) {
            final Intent intent = new Intent();
            intent.setComponent(new ComponentName("com.android.settings",
                    "com.android.settings.LauncherAppWidgetBinder")); 
            intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
             
            final Bundle extras = new Bundle();
            extras.putIntArray(EXTRA_BIND_SOURCES, bindSources);
            extras.putParcelableArrayList(EXTRA_BIND_TARGETS, bindTargets);
            intent.putExtras(extras);
             
            mContext.startActivity(intent);
        } 
         
        /** 
         * Loads the default set of favorite packages from an xml file. 
6
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:putExtra, putExtras
mBluetoothDeviceDisconnected = true;
	} 
 
    public void sendBluetoothDeviceDisconnectedIntent(Context context, BluetoothDevice device) {
		Intent startServiceIntent = new Intent(context, DeviceGatewayService.class);
        startServiceIntent.putExtra(BluetoothDevice.EXTRA_DEVICE, device);
		Bundle extras = new Bundle();
		extras.putBoolean("bluetoothDeviceDisconnected", true);
		startServiceIntent.putExtras(extras);
		context.startService(startServiceIntent);
	} 
} 
7
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:startActivity, putExtras, setClass
		this.user = user;
	} 
	 
	@Override 
	public void onClick(View v) {
		Intent intent = new Intent();
		Bundle bundle = new Bundle();
         
		bundle.putSerializable("USER", user);
		intent.putExtras(bundle);
 
		intent.setClass(context, ProfileActivity.class);
		((Activity)context).startActivity(intent);
	} 
 
	public User getUser() { 
		return user;
	} 
 
	public void setUser(User user) {
8
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:putExtra, putExtras
    /** 
     * Finishes the activity and returns the given data. 
     */ 
    private void finish(Intent intent, String title) {
        // Give back what was given to us (it will have the shortcut, for example) 
        intent.putExtras(getIntent());
        // Put our information 
        intent.putExtra(EXTRA_TITLE, title);
        setResult(RESULT_OK, intent);
        finish();
    } 
 
    /** 
     * {@inheritDoc} 
     */ 
    public boolean setViewValue(View view, Object data, String textRepresentation) {
        if (view.getId() == R.id.icon) {
            Drawable icon = ((ResolveInfo) data).loadIcon(getPackageManager());
            if (icon != null) {
                ((ImageView) view).setImageDrawable(icon);
7
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:putExtras, setClassName
    } 
 
    @Override 
    protected void setUp() throws Exception { 
        super.setUp(); 
        Intent i = new Intent();
        i.setClassName(testPackage, mainActivity.getName());
        i.putExtras(extras);
        setActivityIntent(i);
        solo = new SoloEnhanced(getInstrumentation(), this.getActivity());
        viewFetcher = new PublicViewFetcher(getInstrumentation(), this.getActivity());
        actions = new Actions(getInstrumentation(), this);
        instrumentation = getInstrumentation();
    } 
 
    /** 
     * Here to have JUnit3 start the instrumentationBackend 
     */ 
    public void testHook() throws Exception { 
        HttpServer httpServer = HttpServer.getInstance();
8
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:putExtras
    public void handleDecode(Result result, Bitmap barcode) {
        inactivityTimer.onActivity();
        playBeepSoundAndVibrate(); 
 
        final String resultString = result.getText();
        Intent resultIntent = new Intent();
        Bundle bundle = new Bundle();
        bundle.putString("result", resultString);
        resultIntent.putExtras(bundle);
        this.setResult(RESULT_OK, resultIntent);
 
        finish();
    } 
 
    private void initCamera(SurfaceHolder surfaceHolder) {
        try { 
            CameraManager.get().openDriver(surfaceHolder);
        } catch (IOException ioe) {
            return; 
        } catch (RuntimeException e) {
7
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:putExtras
	} 
 
	@SuppressWarnings({ "deprecation", "unchecked" }) 
	@Override 
	public View onCreateView(final LayoutInflater inflater, final ViewGroup container, final Bundle savedInstanceState) {
		final Intent intent = new Intent(getActivity(), getActivityClass());
		final Bundle args = getArguments();
		if (args != null) {
			intent.putExtras(args);
		} 
 
		final Window w = getLocalActivityManager().startActivity(ACTIVITY_TAG, intent);
		mAttachedActivity = null;
		final Context context = w.getContext();
		if (context instanceof Activity) {
			try { 
				mAttachedActivity = (A) context;
				if (context instanceof FragmentCallback) {
					((FragmentCallback<A>) context).setCallbackFragment(this);
				} 
7
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:putExtras
		Object o = this.getListAdapter().getItem(position);
		String testName = o.toString();
 
		Bundle bundle = new Bundle();
		bundle.putString("test", testName);
		Intent intent = new Intent(this, GdxTestActivity.class);
		intent.putExtras(bundle);
 
		startActivity(intent);
	} 
 
} 
8
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:putExtras, setAction
        map.putString("pin2", getPin2());
 
        Intent intent = getIntent();
        Uri uri = intent.getData();
 
        Intent action = new Intent();
        if (uri != null) action.setAction(uri.toString());
        setResult(RESULT_OK, action.putExtras(map));
        finish();
    } 
 
    @Override 
    public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
        if (actionId == EditorInfo.IME_ACTION_DONE) {
            mOkButton.performClick();
            return true; 
        } 
        return false; 
    } 
 
7
CodeRank
Connect your IDE to all the code out there  Get Codota for Java

Related Intent putExtras Questions & Answers:

putExtras Method Overview
Copy all extras in 'src' in to this intent.
See Code Examples for other Android Intent Methods: