当前位置: 首页>>代码示例>>Java>>正文


Java Intent.getParcelableExtra方法代码示例

本文整理汇总了Java中android.content.Intent.getParcelableExtra方法的典型用法代码示例。如果您正苦于以下问题:Java Intent.getParcelableExtra方法的具体用法?Java Intent.getParcelableExtra怎么用?Java Intent.getParcelableExtra使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.content.Intent的用法示例。


在下文中一共展示了Intent.getParcelableExtra方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onReceive

import android.content.Intent; //导入方法依赖的package包/类
@Override
public void onReceive(Context context, Intent intent) {
    switch (intent.getAction()) {
        case Installer.ACTION_INSTALL_STARTED:
            break;
        case Installer.ACTION_INSTALL_COMPLETE:
            localBroadcastManager.unregisterReceiver(this);

            showRelevantView(true);
            break;
        case Installer.ACTION_INSTALL_INTERRUPTED:
            localBroadcastManager.unregisterReceiver(this);
            // TODO: handle errors!
            break;
        case Installer.ACTION_INSTALL_USER_INTERACTION:
            PendingIntent installPendingIntent =
                    intent.getParcelableExtra(Installer.EXTRA_USER_INTERACTION_PI);

            try {
                installPendingIntent.send();
            } catch (PendingIntent.CanceledException e) {
                Log.e(TAG, "PI canceled", e);
            }

            break;
        default:
            throw new RuntimeException("intent action not handled!");
    }
}
 
开发者ID:uhuru-mobile,项目名称:mobile-store,代码行数:30,代码来源:SwapWorkflowActivity.java

示例2: setPowerNotificationRingtone

import android.content.Intent; //导入方法依赖的package包/类
private void setPowerNotificationRingtone(Intent intent) {
    final Uri uri = intent.getParcelableExtra(RingtoneManager.EXTRA_RINGTONE_PICKED_URI);

    final String toneName;
    final String toneUriPath;

    if ( uri != null ) {
        final Ringtone ringtone = RingtoneManager.getRingtone(getActivity(), uri);
        toneName = ringtone.getTitle(getActivity());
        toneUriPath = uri.toString();
    } else {
        // silent
        toneName = getString(R.string.power_notifications_ringtone_silent);
        toneUriPath = POWER_NOTIFICATIONS_SILENT_URI;
    }

    mPowerSoundsRingtone.setSummary(toneName);
    CMSettings.Global.putString(getContentResolver(),
            CMSettings.Global.POWER_NOTIFICATIONS_RINGTONE, toneUriPath);
}
 
开发者ID:ric96,项目名称:lineagex86,代码行数:21,代码来源:OtherSoundSettings.java

示例3: iniitialize

import android.content.Intent; //导入方法依赖的package包/类
@Override
public void iniitialize(Intent intent, Bundle bundle) {
    if (!_DEVELOP_MODE) {

        if (bundle != null) {
            usuario = bundle.getParcelable(EXTRA_USER);
        } else {

            FIRST_TIME = intent.getBooleanExtra(Constants._FIRST_TIME, false);
            usuario = intent.getParcelableExtra(EXTRA_USER);
        }

        if (FIRST_TIME) {
            view.disableEditEmail();
        }

        view.setupViews(usuario);
    }
}
 
开发者ID:pedromassango,项目名称:Programmers,代码行数:20,代码来源:Presenter.java

示例4: onCreate

import android.content.Intent; //导入方法依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    Intent intent = getIntent();
    if (UsbManager.ACTION_USB_DEVICE_ATTACHED.equals(intent.getAction())) {
        UsbDevice usbDevice = intent.getParcelableExtra(UsbManager.EXTRA_DEVICE);
        Log.d(TAG, "USB DVB-T attached: " + usbDevice.getDeviceName());
        Intent newIntent = new Intent(ACTION_DVB_DEVICE_ATTACHED);
        newIntent.putExtra(UsbManager.EXTRA_DEVICE, usbDevice);
        try {
            startActivity(newIntent);
        } catch (ActivityNotFoundException e) {
            Log.d(TAG, "No activity found for DVB-T handling");
        }
    }

    finish();
}
 
开发者ID:martinmarinov,项目名称:AndroidDvbDriver,代码行数:20,代码来源:UsbDelegate.java

示例5: onNewIntent

import android.content.Intent; //导入方法依赖的package包/类
@Override
protected void onNewIntent(Intent intent) {
  super.onNewIntent(intent);

  if (UsbManager.ACTION_USB_DEVICE_ATTACHED.equals(intent.getAction())) {
    UsbDevice usbDevice = intent.getParcelableExtra(UsbManager.EXTRA_DEVICE);
    RobotLog.vv(TAG, "ACTION_USB_DEVICE_ATTACHED: %s", usbDevice.getDeviceName());

    if (usbDevice != null) {  // paranoia
      // We might get attachment notifications before the event loop is set up, so
      // we hold on to them and pass them along only when we're good and ready.
      if (receivedUsbAttachmentNotifications != null) { // *total* paranoia
        receivedUsbAttachmentNotifications.add(usbDevice);
        passReceivedUsbAttachmentsToEventLoop();
      }
    }
  }
}
 
开发者ID:SCHS-Robotics,项目名称:Team9261-2017-2018,代码行数:19,代码来源:FtcRobotControllerActivity.java

示例6: handleSendImage

import android.content.Intent; //导入方法依赖的package包/类
@Nullable
private String handleSendImage(Intent intent) {
    Uri imageUri = (Uri) intent.getParcelableExtra(Intent.EXTRA_STREAM);
    if (imageUri != null) {
        try {
            final InputStream imageStream = getCurrentActivity().getContentResolver().openInputStream(imageUri);
            final Bitmap selectedImage = BitmapFactory.decodeStream(imageStream);
            String encodedImage = encodeImage(selectedImage);

            return encodedImage;
        } catch(IOException e) {
        }
    }
    return null;
}
 
开发者ID:sonnylazuardi,项目名称:react-native-image-intent,代码行数:16,代码来源:ImageIntentModule.java

示例7: onNewIntent

import android.content.Intent; //导入方法依赖的package包/类
public void onNewIntent(Intent intent) {
    Tag detectedTag = intent.getParcelableExtra(NfcAdapter.EXTRA_TAG);
    NdefMessage ndefMessage = new NdefMessage(new NdefRecord[]{createUriRecord(mUri)});
    boolean result = writeTag(ndefMessage, detectedTag);
    if (result) {
        Toast.makeText(this, "写入成功", Toast.LENGTH_SHORT).show();
    } else {
        Toast.makeText(this, "写入失败", Toast.LENGTH_SHORT).show();
    }
}
 
开发者ID:jopenbox,项目名称:android-nfc,代码行数:11,代码来源:WriteUriActivity.java

示例8: onCreate

import android.content.Intent; //导入方法依赖的package包/类
@Override
@SuppressLint("NewApi")
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.crop_image_activity);

    mCropImageView = (CropImageView) findViewById(R.id.cropImageView);

    Intent intent = getIntent();
    mCropImageUri = intent.getParcelableExtra(CropImage.CROP_IMAGE_EXTRA_SOURCE);
    mOptions = intent.getParcelableExtra(CropImage.CROP_IMAGE_EXTRA_OPTIONS);

    if (savedInstanceState == null) {
        if (mCropImageUri == null || mCropImageUri.equals(Uri.EMPTY)) {
            if (CropImage.isExplicitCameraPermissionRequired(this)) {
                // request permissions and handle the result in onRequestPermissionsResult()
                requestPermissions(new String[]{Manifest.permission.CAMERA}, CropImage.CAMERA_CAPTURE_PERMISSIONS_REQUEST_CODE);
            } else {
                CropImage.startPickImageActivity(this);
            }
        } else if (CropImage.isReadExternalStoragePermissionsRequired(this, mCropImageUri)) {
            // request permissions and handle the result in onRequestPermissionsResult()
            requestPermissions(new String[]{Manifest.permission.READ_EXTERNAL_STORAGE}, CropImage.PICK_IMAGE_PERMISSIONS_REQUEST_CODE);
        } else {
            // no permissions required or already grunted, can start crop image activity
            mCropImageView.setImageUriAsync(mCropImageUri);
        }
    }

    ActionBar actionBar = getSupportActionBar();
    if (actionBar != null) {
        String title = mOptions.activityTitle != null && !mOptions.activityTitle.isEmpty()
                ? mOptions.activityTitle
                : getResources().getString(R.string.crop_image_activity_title);
        actionBar.setTitle(title);
        actionBar.setDisplayHomeAsUpEnabled(true);
    }
}
 
开发者ID:chuch0805,项目名称:Android-Demo_ImageCroper,代码行数:39,代码来源:CropImageActivity.java

示例9: checkLocalStreams

import android.content.Intent; //导入方法依赖的package包/类
public static ArrayList<Uri> checkLocalStreams(Activity activity) {
    Intent intent = activity.getIntent();
    if (intent == null) {
        return null;
    }

    Bundle extras = intent.getExtras();
    String action = intent.getAction();
    if (extras == null || action == null) {
        return null;
    }

    if (Intent.ACTION_SEND_MULTIPLE.equals(action)) {
        if (extras.containsKey(Intent.EXTRA_STREAM)) {
            return intent.getParcelableArrayListExtra(Intent.EXTRA_STREAM);
        }
    }

    if (Intent.ACTION_SEND.equals(action)) {
        if (extras.containsKey(Intent.EXTRA_STREAM)) {
            Uri uri = intent.getParcelableExtra(Intent.EXTRA_STREAM);
            if (uri != null) {
                ArrayList<Uri> streams = new ArrayList<>(1);
                streams.add(uri);
                return streams;
            }
        }
    }

    return null;
}
 
开发者ID:PhoenixDevTeam,项目名称:Phoenix-for-VK,代码行数:32,代码来源:ActivityUtils.java

示例10: onCreate

import android.content.Intent; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    Intent intent = getIntent();
    Intent vpnIntent = intent.getParcelableExtra(EXTRA_VPN_INTENT);
    config = intent.getParcelableExtra(EXTRA_VPN_CONFIGURATION);
    startActivityForResult(vpnIntent, VPN_REQUEST_CODE);
}
 
开发者ID:Genymobile,项目名称:gnirehtet,代码行数:9,代码来源:AuthorizationActivity.java

示例11: performReceive

import android.content.Intent; //导入方法依赖的package包/类
public void performReceive(Intent intent, int resultCode, String data, Bundle extras, boolean ordered,
                           boolean sticky, int sendingUser) throws RemoteException {
    if (!accept(intent)) {
        return;
    }
    if (intent.hasExtra("_VA_|_intent_")) {
        intent = intent.getParcelableExtra("_VA_|_intent_");
    }
    SpecialComponentList.unprotectIntent(intent);
    if (Build.VERSION.SDK_INT > Build.VERSION_CODES.JELLY_BEAN) {
        IIntentReceiverJB.performReceive.call(mOld, intent, resultCode, data, extras, ordered, sticky, sendingUser);
    } else {
        mirror.android.content.IIntentReceiver.performReceive.call(mOld, intent, resultCode, data, extras, ordered, sticky);
    }
}
 
开发者ID:coding-dream,项目名称:TPlayer,代码行数:16,代码来源:MethodProxies.java

示例12: onActivityResult

import android.content.Intent; //导入方法依赖的package包/类
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    if (requestCode == NEW_TRIP_REQUEST) {
        if (data != null && data.hasExtra("TRIP")) {
            Parcelable par = data.getParcelableExtra("TRIP");
            Trip t = Parcels.unwrap(par);
            topRef.push().setValue(t);
            Snackbar.make(toolbar, "New Trip Added", Snackbar.LENGTH_SHORT).show();
        }
    }
    else
        super.onActivityResult(requestCode, resultCode, data);
}
 
开发者ID:gvsucis,项目名称:mobile-app-dev-book,代码行数:14,代码来源:MainActivity.java

示例13: onReceive

import android.content.Intent; //导入方法依赖的package包/类
@Override
public void onReceive(Context context, Intent intent) {
    String action = intent.getAction();
    UsbDevice usbDevice = intent.getParcelableExtra(UsbManager.EXTRA_DEVICE);
    String deviceName = usbDevice.getDeviceName();
    if (UsbStorageProvider.ACTION_USB_PERMISSION.equals(action)) {
        boolean permission = intent.getBooleanExtra(UsbManager.EXTRA_PERMISSION_GRANTED, false);
        if (permission) {
            discoverDevice(usbDevice);
            notifyRootsChanged();
            notifyDocumentsChanged(getContext(), getRootId(usbDevice)+ROOT_SEPERATOR);
        } else {
            // so we don't ask for permission again
        }
    } else if (UsbManager.ACTION_USB_DEVICE_ATTACHED.equals(action)
            || UsbManager.ACTION_USB_DEVICE_DETACHED.equals(action)) {
        updateRoots();
    }
}
 
开发者ID:kranthi0987,项目名称:easyfilemanager,代码行数:20,代码来源:UsbStorageProvider.java

示例14: onReceive

import android.content.Intent; //导入方法依赖的package包/类
@Override
public void onReceive(Context context, Intent intent) {
    final DriveId driveId = intent.getParcelableExtra(GDriveEventService.BUNDLE_DRIVEID);

    Log.i(TAG, "onReceive completion event for driveID:" + driveId.encodeToString());

    if (driveId.equals(mDriveId)) {
        result =  intent.getIntExtra(GDriveEventService.BUNDLE_SUCCESS, -1);
        synchronized (this) {
            notify();
        }
    }
}
 
开发者ID:claudiodegio,项目名称:dbsync,代码行数:14,代码来源:GDriveCloudProvider.java

示例15: onStart

import android.content.Intent; //导入方法依赖的package包/类
public int onStart(Context context, Intent intent, int flags, int startId) throws Exception {
    Intent targetIntent = intent.getParcelableExtra(Env.EXTRA_TARGET_INTENT);
    if (targetIntent != null) {
        ServiceInfo targetInfo = PluginManager.getInstance().resolveServiceInfo(targetIntent, 0);
        if (targetInfo != null) {
            Service service = mNameService.get(targetInfo.name);
            if (service == null) {

                handleCreateServiceOne(context, intent, targetInfo);
            }
            handleOnStartOne(targetIntent, flags, startId);
        }
    }
    return -1;
}
 
开发者ID:amikey,项目名称:DroidPlugin,代码行数:16,代码来源:ServcesManager.java


注:本文中的android.content.Intent.getParcelableExtra方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。