Intent getParcelableExtra - 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 getParcelableExtra method.

This code example shows how to use the following methods:getAction, getParcelableExtra
  } 
 
  private BroadcastReceiver plugin=new BroadcastReceiver() {
    @Override 
    public void onReceive(Context ctxt, Intent i) { 
      if (ACTION_REGISTER_PLUGIN.equals(i.getAction())) { 
        pluginCN=(ComponentName)i.getParcelableExtra(EXTRA_COMPONENT); 
      } 
      else if (ACTION_DELIVER_CONTENT.equals(i.getAction())) { 
        RemoteViews rv=(RemoteViews)i.getParcelableExtra(EXTRA_CONTENT); 
        ViewGroup frame=(ViewGroup)findViewById(android.R.id.content); 
 
        frame.removeAllViews(); 
 
        View pluginView=rv.apply(RemoteViewsHostActivity.this, frame); 
 
        frame.addView(pluginView); 
      } 
    } 
  }; 
7
CodeRank
This code example shows how to use the following methods:getAction, getParcelableExtra
    SupplicantState mSupplicantState;
 
    private class WifiStateListener extends BroadcastReceiver {
        @Override 
        public void onReceive(Context context, Intent intent) {
            String action = intent.getAction();
            if (action.equals(WifiManager.WIFI_STATE_CHANGED_ACTION)) {
                mWifiState = intent.getIntExtra(WifiManager.EXTRA_WIFI_STATE,
                        WifiManager.WIFI_STATE_UNKNOWN);
                switch (mWifiState) {
                    case WifiManager.WIFI_STATE_DISABLING:
                        if (mDisableBroadcastCounter == 0) mDisableBroadcastCounter++;
                        break; 
                    case WifiManager.WIFI_STATE_DISABLED:
                        if (mDisableBroadcastCounter == 1) mDisableBroadcastCounter++;
                        break; 
                    case WifiManager.WIFI_STATE_ENABLING:
                        if (mEnableBroadcastCounter == 0) mEnableBroadcastCounter++;
                        break; 
                    case WifiManager.WIFI_STATE_ENABLED:

7
CodeRank
This code example shows how to use the following methods:getBooleanExtra, getIntExtra, getParcelableExtra
    public _RingtonePickerDialog create() { 
        if (dialog != null) {
            return this;
        } 
        handler = new Handler();
        hasDefaultItem = intent.getBooleanExtra(
                RingtoneManager.EXTRA_RINGTONE_SHOW_DEFAULT, true);
        uriForDefaultItem = intent
                .getParcelableExtra(RingtoneManager.EXTRA_RINGTONE_DEFAULT_URI);
        if (uriForDefaultItem == null) {
            uriForDefaultItem = Settings.System.DEFAULT_RINGTONE_URI;
        } 
        hasSilentItem = intent.getBooleanExtra(
                RingtoneManager.EXTRA_RINGTONE_SHOW_SILENT, true);
        ringtoneManager = new RingtoneManager(context);
        final boolean includeDrm = intent.getBooleanExtra(
                RingtoneManager.EXTRA_RINGTONE_INCLUDE_DRM, true);
        ringtoneManager.setIncludeDrm(includeDrm);
        int types = intent.getIntExtra(RingtoneManager.EXTRA_RINGTONE_TYPE, -1);
        if (types != -1) {

9
CodeRank
This code example shows how to use the following methods:getAction, getBooleanExtra, getParcelableExtra
     * Notification event  
     */ 
	@Override 
	public void onReceive( Context aContext, Intent aIntent )
	{ 
		Boolean connectivity = !aIntent.getBooleanExtra( ConnectivityManager.EXTRA_NO_CONNECTIVITY, false );
		NetworkInfo netInfo = aIntent.getParcelableExtra( ConnectivityManager.EXTRA_NETWORK_INFO ); 
		 
		Log.i( WazeLog.TAG( "ConnEventReceiver" ), "Received event: " + aIntent.getAction() + ". Connectivity: " + connectivity + 
				". Type: " + netInfo.getTypeName() + " ( " + netInfo.getType() + " )" + 
				". State: " + netInfo.getState().toString() + 
				". Connected: " + netInfo.isConnected() );
		 
		FreeMapNativeManager mgr = FreeMapAppService.getNativeManager();
		 
		if ( mgr != null )
			mgr.ConnectivityChanged( netInfo.isConnected(), netInfo.getType(),  netInfo.getTypeName() );
		 
	} 
 
7
CodeRank
This code example shows how to use the following methods:getAction, getParcelableExtra, getStringExtra
    public static final String BOX_RECEIVER_CLASS_NAME = "com.box.android.onecloud.OneCloudReceiver";
 
    @Override 
    public void onReceive(final Context context, final Intent intent) {
        OneCloudData oneCloudData = null;
        if (intent.getParcelableExtra(EXTRA_ONE_CLOUD) != null) {
            oneCloudData = (OneCloudData) intent.getParcelableExtra(EXTRA_ONE_CLOUD);
            oneCloudData.sendHandshake(context);
        } 
 
        if (intent.getAction().equals(ACTION_BOX_EDIT_FILE)) {
            onEditFileRequested(context, oneCloudData);
        } 
        else if (intent.getAction().equals(ACTION_BOX_CREATE_FILE)) {
            onCreateFileRequested(context, oneCloudData);
        } 
        else if (intent.getAction().equals(ACTION_BOX_VIEW_FILE)) {
            onViewFileRequested(context, oneCloudData);
        } 
        else if (intent.getAction().equals(ACTION_BOX_LAUNCH)) {

7
CodeRank
This code example shows how to use the following methods:getAction, getParcelableExtra
 */ 
public class ConnectivityReceiver extends BroadcastReceiver {
 
	@Override 
	public void onReceive(Context context, Intent intent) {
		if (!ConnectivityManager.CONNECTIVITY_ACTION.equals(intent.getAction()))
			return; 
		NetworkInfo networkInfo = (NetworkInfo) intent
				.getParcelableExtra(ConnectivityManager.EXTRA_NETWORK_INFO);
		if (networkInfo == null) {
			LogManager.e(this, "NO INFO");
			return; 
		} 
		NetworkManager.getInstance().onNetworkChange(networkInfo);
	} 
 
} 
7
CodeRank
This code example shows how to use the following methods:getParcelableExtra
        activity.registerReceiver(this, filter);
    } 
 
    @Override 
    public void onReceive(Context context, Intent intent) {
        UsbDevice device = (UsbDevice)intent.getParcelableExtra(UsbManager.EXTRA_DEVICE);
        String deviceName = device.getDeviceName();
        Log.d(TAG, "ACTION_USB_DEVICE_DETACHED " + deviceName);
 
        // close our activity if the device it is displaying is disconnected 
        if (deviceName.equals(mDeviceName)) {
            mActivity.finish();
        } 
    } 
} 
7
CodeRank
This code example shows how to use the following methods:getParcelableExtra, getStringExtra
    } 
  } 
   
  @Override 
  protected void onHandleIntent(Intent intent) {
    String script=intent.getStringExtra(SCRIPT);
     
    if (script!=null) {
      try { 
        success(intent, i.eval(script).toString());
      } 
      catch (Throwable e) {
        Log.e("BshService", "Error executing script", e);
         
        try { 
          failure(intent, e.getMessage());
        } 
        catch (Throwable t) {
          Log.e("BshService",
                "Error returning exception to client", 

8
CodeRank
This code example shows how to use the following methods:getParcelableExtra, getStringExtra
 
    send(intent, data);
  } 
   
  private void send(Intent intent, Intent data) {
    String broadcast=intent.getStringExtra(BROADCAST_ACTION);
     
    if (broadcast==null) {
      PendingIntent pi=(PendingIntent)intent.getParcelableExtra(PENDING_RESULT);
       
      if (pi!=null) {
        try { 
          pi.send(this, Activity.RESULT_OK, data);
        } 
        catch (PendingIntent.CanceledException e) {
          // no-op -- client must be gone 
        } 
      } 
    } 
    else { 
7
CodeRank
This code example shows how to use the following methods:getParcelableExtra, getStringExtra, putExtra, toUri
            mParent.startActivityForResult(intent, requestCodeShortcut);
        } 
    } 
 
    private void completeSetCustomApp(Intent data) {
        mListener.shortcutPicked(data.toUri(0), getFriendlyActivityName(data, false), true);
    } 
 
    private void completeSetCustomShortcut(Intent data) {
        Intent intent = data.getParcelableExtra(Intent.EXTRA_SHORTCUT_INTENT);
        /* preserve shortcut name, we want to restore it later */ 
        intent.putExtra(Intent.EXTRA_SHORTCUT_NAME, data.getStringExtra(Intent.EXTRA_SHORTCUT_NAME));
        String appUri = intent.toUri(0);
        appUri = appUri.replaceAll("com.android.contacts.action.QUICK_CONTACT", "android.intent.action.VIEW");
        mListener.shortcutPicked(appUri, getFriendlyShortcutName(intent), false);
    } 
 
    private String getFriendlyActivityName(Intent intent, boolean labelOnly) {
        PackageManager pm = mParent.getPackageManager();
        ActivityInfo ai = intent.resolveActivityInfo(pm, PackageManager.GET_ACTIVITIES);

8
CodeRank

Related Intent getParcelableExtra Questions & Answers:

getParcelableExtra Method Overview
Retrieve extended data from the intent.
See Code Examples for other Android Intent Methods: