Example usage for android.content Intent putParcelableArrayListExtra

List of usage examples for android.content Intent putParcelableArrayListExtra

Introduction

In this page you can find the example usage for android.content Intent putParcelableArrayListExtra.

Prototype

public @NonNull Intent putParcelableArrayListExtra(String name, ArrayList<? extends Parcelable> value) 

Source Link

Document

Add extended data to the intent.

Usage

From source file:org.alfresco.mobile.android.application.managers.ActionUtils.java

public static void actionSendDocuments(Fragment fr, List<File> files) {
    if (files.size() == 1) {
        actionSendDocument(fr, files.get(0));
        return;/*from   ww  w  .  j  av  a2s .  c om*/
    }

    try {
        Intent i = new Intent(Intent.ACTION_SEND_MULTIPLE);
        ArrayList<Uri> uris = new ArrayList<>();
        // convert from paths to Android friendly Parcelable Uri's
        for (File file : files) {
            Uri u = Uri.fromFile(file);
            uris.add(u);
        }
        i.putParcelableArrayListExtra(Intent.EXTRA_STREAM, uris);
        i.setType(MimeTypeManager.getInstance(fr.getActivity()).getMIMEType("text/plain"));
        fr.getActivity()
                .startActivity(Intent.createChooser(i, fr.getActivity().getText(R.string.share_content)));
    } catch (ActivityNotFoundException e) {
        AlfrescoNotificationManager.getInstance(fr.getActivity()).showAlertCrouton(fr.getActivity(),
                R.string.error_unable_share_content);
    }
}

From source file:com.entertailion.android.dial.ServerFinder.java

/**
 * Returns an intent that starts this activity.
 *///from ww w  .j a v a  2s .c o  m
public static Intent createConnectIntent(Context ctx, DialServer recentlyConnected,
        ArrayList<DialServer> recentlyConnectedList) {
    Intent intent = new Intent(ctx, ServerFinder.class);
    intent.putExtra(EXTRA_DIAL_SERVER, recentlyConnected);
    intent.putParcelableArrayListExtra(EXTRA_RECENTLY_CONNECTED, recentlyConnectedList);
    return intent;
}

From source file:org.alfresco.mobile.android.application.managers.ActionUtils.java

public static void actionSendDocumentsToAlfresco(FragmentActivity activity, List<File> files) {
    if (files.size() == 1) {
        actionSendDocumentToAlfresco(activity, files.get(0));
        return;//from  w  ww  .j av a2s  .c  o  m
    }

    try {
        Intent i = new Intent(activity, PublicDispatcherActivity.class);
        i.setAction(Intent.ACTION_SEND_MULTIPLE);
        ArrayList<Uri> uris = new ArrayList<>();
        // convert from paths to Android friendly Parcelable Uri's
        for (File file : files) {
            Uri u = Uri.fromFile(file);
            uris.add(u);
        }
        i.putParcelableArrayListExtra(Intent.EXTRA_STREAM, uris);
        i.setType(MimeTypeManager.getInstance(activity).getMIMEType("text/plain"));
        activity.startActivity(i);
    } catch (ActivityNotFoundException e) {
        AlfrescoNotificationManager.getInstance(activity).showAlertCrouton(activity,
                R.string.error_unable_share_content);
    }
}

From source file:Main.java

public static void addToFacebookContact(Context mContext, ArrayList<String> contactDatas) {

    /**/*from   w w  w  . ja  va  2 s  .c  om*/
     * ArrayList elements:
     * 
     * 1. Name 2. Userid 3.Username
     */

    Intent i = new Intent(Intent.ACTION_INSERT_OR_EDIT);
    i.setType(ContactsContract.Contacts.CONTENT_ITEM_TYPE);

    if (contactDatas.get(2) == null) {
        contactDatas.set(2, "Facebook name");
    }

    ArrayList<ContentValues> data = new ArrayList<ContentValues>();
    ContentValues row1 = new ContentValues();
    row1.put(ContactsContract.Data.MIMETYPE, ContactsContract.CommonDataKinds.Im.CONTENT_ITEM_TYPE);
    row1.put(ContactsContract.Data.DATA1, contactDatas.get(2));
    row1.put(ContactsContract.Data.DATA2, ContactsContract.CommonDataKinds.Im.TYPE_OTHER);
    row1.put(ContactsContract.Data.DATA5, ContactsContract.CommonDataKinds.Im.PROTOCOL_CUSTOM);
    row1.put(ContactsContract.Data.DATA6, "Facebook");
    row1.put(ContactsContract.Data.DATA10, contactDatas.get(1));
    data.add(row1);

    i.putExtra(Insert.NAME, contactDatas.get(0));
    i.putParcelableArrayListExtra(ContactsContract.Intents.Insert.DATA, data);

    mContext.startActivity(i);
}

From source file:com.google.android.apps.tvremote.DeviceFinder.java

/**
 * Returns an intent that starts this activity.
 *///  w w w  . java  2s . c  o  m
public static Intent createConnectIntent(Context ctx, RemoteDevice recentlyConnected,
        ArrayList<RemoteDevice> recentlyConnectedList) {
    mContext = ctx;

    Intent intent = new Intent(ctx, DeviceFinder.class);
    intent.putExtra(EXTRA_REMOTE_DEVICE, recentlyConnected);
    intent.putParcelableArrayListExtra(EXTRA_RECENTLY_CONNECTED, recentlyConnectedList);
    return intent;
}

From source file:com.chute.android.photopickerplustutorial.activity.PhotoPickerPlusTutorialActivity.java

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    if (resultCode != Activity.RESULT_OK) {
        return;//from  ww w  . ja  va 2  s.c o m
    }
    final PhotoPickerPlusIntentWrapper wrapper = new PhotoPickerPlusIntentWrapper(data);
    List<AssetModel> accountMediaList = wrapper.getMediaCollection();
    AccountModel accountModel = wrapper.getAccountModel();

    Log.d(TAG, accountMediaList.toString());
    Intent intent = new Intent(getApplicationContext(), PhotoGridActivity.class);
    intent.putParcelableArrayListExtra(KEY_MEDIA_LSIT, (ArrayList) accountMediaList);
    startActivity(intent);

}

From source file:cn.com.mark.multiimage.core.ImagesBaseActivity.java

public void submit() {
    ArrayList<Uri> respUris = new ArrayList<Uri>();
    if (isOriginal) {
        for (int i = 0; i < sResult.size(); i++) {
            ImageEntity data = sResult.get(i);
            Uri uri = Uri.parse("file:///" + data.getUrl());
            respUris.add(uri);/*from  www.  j av  a  2  s  . c om*/
        }
    } else {
        for (int i = 0; i < sResult.size(); i++) {
            ImageEntity data = sResult.get(i);
            Bitmap bm = BitmapUtils.getThumbnail(this, data.getId());
            String path = getCachePath();
            if (saveCacheDir(path, bm)) {
                Uri uri = Uri.parse("file:///" + path);
                respUris.add(uri);
            }
        }
    }
    sResult.clear();

    if (respUris != null && respUris.size() > 0) {
        Intent intent = new Intent();
        intent.putParcelableArrayListExtra("result", respUris);
        setResult(RESULT_OK, intent);
    } else {
        setResult(RESULT_CANCELED);
    }
    finish();
}

From source file:com.laevatein.internal.ui.helper.PhotoGridViewHelper.java

public static void callPreview(Context context, Item item, List<Uri> checked) {
    PhotoSelectionActivity activity = (PhotoSelectionActivity) context;
    ViewResourceSpec resources = activity.getIntent()
            .getParcelableExtra(PhotoSelectionActivity.EXTRA_VIEW_SPEC);
    Intent intent = new Intent(context, ImagePreviewActivity.class);
    Fragment fragment = activity.getSupportFragmentManager().findFragmentById(R.id.l_container_grid_fragment);
    Album album = fragment.getArguments().getParcelable(PhotoGridFragment.ARGS_ALBUM);
    intent.putExtra(ImagePreviewActivity.EXTRA_ALBUM, album);
    intent.putExtra(ImagePreviewActivity.EXTRA_ITEM, item);
    intent.putExtra(ImagePreviewActivity.EXTRA_ERROR_SPEC,
            activity.getIntent().getParcelableExtra(PhotoSelectionActivity.EXTRA_ERROR_SPEC));
    intent.putExtra(ImagePreviewActivity.EXTRA_SELECTION_SPEC,
            activity.getIntent().getParcelableExtra(PhotoSelectionActivity.EXTRA_SELECTION_SPEC));
    intent.putExtra(ImagePreviewActivity.EXTRA_VIEW_SPEC,
            activity.getIntent().getParcelableExtra(PhotoSelectionActivity.EXTRA_VIEW_SPEC));
    intent.putExtra(ImagePreviewActivity.EXTRA_CHECK_VIEW_RES, resources.getActionViewResources());
    intent.putParcelableArrayListExtra(ImagePreviewActivity.EXTRA_DEFAULT_CHECKED, (ArrayList<Uri>) checked);
    activity.startActivityForResult(intent, PhotoSelectionActivity.REQUEST_CODE_PREVIEW);
}

From source file:hr.kodbiro.quickbyte.activities.TrolleyActivity.java

private void finishActivityWithList() {
    Intent intent = new Intent();
    intent.putParcelableArrayListExtra("orderList", (ArrayList<? extends android.os.Parcelable>) orderList);
    setResult(1, intent);/*from  w  w w .ja va  2  s  .co m*/
    finish();
}

From source file:com.snowdream.wallpaper.ImageGridFragment.java

private GridView initUI() {
    mGridView = (GridView) getActivity().getLayoutInflater().inflate(R.layout.list_grid, null);
    mGridView.setBackgroundResource(android.R.color.black);
    mGridView.setAdapter(new ImageGridAdapter());
    mGridView.setOnItemClickListener(new OnItemClickListener() {
        @Override//from w  ww  .j av  a  2 s .co m
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            if (getActivity() == null)
                return;

            Image image = (Image) view.getTag();
            if (image == null)
                return;

            ListAdapter adapter = mGridView.getAdapter();
            if ((adapter == null) || !(adapter instanceof ImageGridAdapter)) {
                return;
            }

            ImageGridActivity activity = (ImageGridActivity) getActivity();

            Intent intent = new Intent(activity, ImagePagerActivity.class);
            intent.putParcelableArrayListExtra(Extra.IMAGES,
                    (ArrayList<? extends Parcelable>) ((ImageGridAdapter) adapter).getList());
            intent.putExtra(Extra.IMAGE_POSITION, position);
            startActivity(intent);
        }
    });
    return mGridView;
}