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:co.edu.uniajc.vtf.content.NavigationActivity.java

public void onClick_Route(View view) {
    Intent loIntent = new Intent(this, NavigationRouteActivity.class);
    loIntent.putParcelableArrayListExtra("routemap", this.coDirectionPoints);
    this.startActivity(loIntent);
}

From source file:io.valuesfeng.picker.Picker.java

/**
 * Start to select photo.//www. ja  va  2  s.  c  o  m
 *
 * @param requestCode identity of the requester activity.
 */
public void forResult(int requestCode) {
    if (engine == null)
        throw new ExceptionInInitializerError(LoadEngine.INITIALIZE_ENGINE_ERROR);

    Activity activity = getActivity();
    if (activity == null) {
        return; // cannot continue;
    }
    mSelectionSpec.setMimeTypeSet(mMimeType);
    mSelectionSpec.setEngine(engine);
    Intent intent = new Intent(activity, ImageSelectActivity.class);
    intent.putExtra(ImageSelectActivity.EXTRA_SELECTION_SPEC, mSelectionSpec);
    //        intent.putExtra(ImageSelectActivity.EXTRA_ENGINE, (Serializable) engine);
    intent.putParcelableArrayListExtra(ImageSelectActivity.EXTRA_RESUME_LIST,
            (ArrayList<? extends android.os.Parcelable>) mResumeList);

    Fragment fragment = getFragment();
    if (fragment != null) {
        fragment.startActivityForResult(intent, requestCode);
    } else {
        activity.startActivityForResult(intent, requestCode);
    }
    hasInitPicker = false;
}

From source file:fr.cph.chicago.core.fragment.FavoritesFragment.java

@Override
public final View onCreateView(final LayoutInflater inflater, final ViewGroup container,
        final Bundle savedInstanceState) {
    if (!activity.isFinishing()) {
        rootView = inflater.inflate(R.layout.fragment_main, container, false);
        unbinder = ButterKnife.bind(this, rootView);
        if (favoritesAdapter == null) {
            favoritesAdapter = new FavoritesAdapter(activity);
            favoritesAdapter.setTrainArrivals(trainArrivals);
            favoritesAdapter.setBusArrivals(busArrivals);
            favoritesAdapter.setBikeStations(bikeStations);
            favoritesAdapter.setFavorites();
        }/*from w w w.  j a  va  2 s.  com*/
        final RecyclerView.LayoutManager mLayoutManager = new LinearLayoutManager(activity);
        listView.setAdapter(favoritesAdapter);
        listView.setLayoutManager(mLayoutManager);
        floatingButton.setOnClickListener(v -> {
            if (bikeStations.isEmpty()) {
                Util.showMessage(activity, R.string.message_too_fast);
            } else {
                final Intent intent = new Intent(activity, SearchActivity.class);
                intent.putParcelableArrayListExtra(bundleBikeStation, (ArrayList<BikeStation>) bikeStations);
                activity.startActivity(intent);
            }
        });
        listView.addOnScrollListener(new RecyclerView.OnScrollListener() {
            @Override
            public void onScrolled(final RecyclerView recyclerView, final int dx, final int dy) {
                if (dy > 0 && floatingButton.isShown()) {
                    floatingButton.hide();
                } else if (dy < 0 && !floatingButton.isShown()) {
                    floatingButton.show();
                }
            }
        });

        swipeRefreshLayout.setOnRefreshListener(() -> {
            swipeRefreshLayout.setColorSchemeColors(Util.getRandomColor());
            Util.trackAction(activity, R.string.analytics_category_req, R.string.analytics_action_get_bus,
                    BUSES_ARRIVAL_URL, 0);
            Util.trackAction(activity, R.string.analytics_category_req, R.string.analytics_action_get_train,
                    TRAINS_ARRIVALS_URL, 0);
            Util.trackAction(activity, R.string.analytics_category_req, R.string.analytics_action_get_divvy,
                    getContext().getString(R.string.analytics_action_get_divvy_all), 0);
            Util.trackAction(activity, R.string.analytics_category_ui, R.string.analytics_action_press,
                    getContext().getString(R.string.analytics_action_refresh_fav), 0);

            final DataHolder dataHolder = DataHolder.getInstance();
            if (dataHolder.getBusData() == null || dataHolder.getBusData().getBusRoutes() == null
                    || dataHolder.getBusData().getBusRoutes().size() == 0
                    || activity.getIntent().getParcelableArrayListExtra(bundleBikeStation) == null
                    || activity.getIntent().getParcelableArrayListExtra(bundleBikeStation).size() == 0) {
                activity.loadFirstData();
            }

            if (Util.isNetworkAvailable(getContext())) {
                final Observable<FavoritesDTO> zipped = ObservableUtil.createAllDataObservable(getContext());
                zipped.subscribe(this::reloadData, onError -> {
                    Log.e(TAG, onError.getMessage(), onError);
                    this.displayError(R.string.message_something_went_wrong);
                });
            } else {
                this.displayError(R.string.message_network_error);
            }
        });

        startRefreshTask();
    }
    return rootView;
}

From source file:eu.thecoder4.gpl.pleftdroid.EditEventActivity.java

/** Called when the activity is first created. */
@Override//  w  ww .j  av  a 2s. c  o  m
public void onCreate(Bundle savedInstanceState) {
    if (AppPreferences.INSTANCE.getUsePleftTheme()) {
        setTheme(R.style.Theme_Pleft);
    }

    super.onCreate(savedInstanceState);
    // Initialiazations
    mTHISEVENT = this;
    mDates = new ArrayList<PDate>();
    mEmails = new ArrayList<String>();
    // The View
    setContentView(R.layout.edit_event);
    // Add Invitee Button
    ((Button) findViewById(R.id.addinvitee)).setOnClickListener(new OnClickListener() {
        public void onClick(View v) {
            Intent iai = new Intent(mTHISEVENT, SelectContactsActivity.class);
            startActivityForResult(iai, ACT_INVITEE);
        }
    });

    // Add Date Button
    ((Button) findViewById(R.id.adddate)).setOnClickListener(new OnClickListener() {
        public void onClick(View v) {
            Intent iad = new Intent(mTHISEVENT, PickDateDialogActivity.class);
            // This would not work: you need a Parcelable
            //iad.putExtra(PickDateDialogActivity.DTLIST, mDates);
            iad.putParcelableArrayListExtra(PickDateDialogActivity.DTLIST, mDates);
            startActivityForResult(iad, ACT_ADDDATE);
        }
    });

    // Send Invitations Button
    ((Button) findViewById(R.id.sendinvite)).setOnClickListener(new OnClickListener() {
        private int SC;

        @SuppressWarnings("static-access")
        public void onClick(View v) {
            String desc = ((EditText) findViewById(R.id.edescription)).getText().toString();
            String invitees = ((EditText) findViewById(R.id.einvitees)).getText().toString();
            String dates = getPleftDates();//"2011-06-23T21:00:00\n2011-06-24T21:00:00\n2011-06-25T21:00:00";
            boolean proposemore = ((CheckBox) findViewById(R.id.mayproposedate)).isChecked();
            if (desc == null || desc.length() == 0 || invitees == null || invitees.length() == 0
                    || dates == null || dates.length() == 0) {
                Toast.makeText(EditEventActivity.this, R.string.event_completeform, Toast.LENGTH_LONG).show();
            } else {
                // Get Preferences

                //Toast.makeText(EditEventActivity.this, "invitees: "+invitees+"\nDesc="+desc+"\npserver="+pserver, Toast.LENGTH_LONG).show();

                SC = PleftBroker.INSTANCE.createAppointment(desc, invitees, dates,
                        AppPreferences.INSTANCE.getPleftServer().trim(), //pserver,
                        AppPreferences.INSTANCE.getName().trim(), //uname,
                        AppPreferences.INSTANCE.getEmail().trim(), //uemail,
                        proposemore);

                if (SC == HttpStatus.SC_OK) {
                    PleftDroidDbAdapter mDbAdapter = new PleftDroidDbAdapter(EditEventActivity.this);
                    mDbAdapter.open();
                    mDbAdapter.createAppointmentAsInvitor(0, desc,
                            AppPreferences.INSTANCE.getPleftServer().trim(),
                            AppPreferences.INSTANCE.getEmail().trim());
                    mDbAdapter.close();
                }

                Bundle bundle = new Bundle();
                bundle.putInt(PleftDroidActivity.SC_CREATE, SC);

                Intent i = new Intent();
                i.putExtras(bundle);
                setResult(RESULT_OK, i);
                // Close activity
                finish();
            }
        }

    });

}

From source file:com.bilibili.boxing.AbsBoxingViewFragment.java

/**
 * called the job is done.Click the ok button, take a photo from camera, crop a photo.
 * most of the time, you do not have to override.
 *
 * @param medias the list of selection//from   w  w w.  jav  a 2s  .  c om
 */
@Override
public void onFinish(@NonNull List<BaseMedia> medias) {
    Intent intent = new Intent();
    intent.putParcelableArrayListExtra(Boxing.EXTRA_RESULT, (ArrayList<BaseMedia>) medias);
    if (mOnFinishListener != null) {
        mOnFinishListener.onBoxingFinish(intent, medias);
    }

}

From source file:moe.yukinoneko.gcomic.module.details.ComicDetailsActivity.java

private void toGallery(int chapterPosition, int browsePosition) {
    Intent intent = new Intent(this, GalleryActivity.class);
    intent.putExtra(GalleryActivity.GALLERY_CMOIC_ID, comicId);
    intent.putExtra(GalleryActivity.GALLERY_CMOIC_FIRST_LETTER, firstLetter);
    intent.putParcelableArrayListExtra(GalleryActivity.GALLERY_CHAPTER_LIST, mAdapter.getAllChapters());
    intent.putExtra(GalleryActivity.GALLERY_CHAPTER_POSITION, chapterPosition);
    intent.putExtra(GalleryActivity.GALLERY_BROWSE_POSITION, browsePosition);
    startActivityForResult(intent, REQUEST_CODE_COMIC_DETAILS);
}

From source file:org.strongswan.android.ui.VpnStateFragment.java

private void showErrorDialog(int textid) {
    final List<RemediationInstruction> instructions = mService.getRemediationInstructions();
    final boolean show_instructions = mService.getImcState() == ImcState.BLOCK && !instructions.isEmpty();
    int text = show_instructions ? R.string.show_remediation_instructions : R.string.show_log;

    mErrorDialog = new AlertDialog.Builder(getActivity())
            .setMessage(getString(R.string.error_introduction) + " " + getString(textid)).setCancelable(false)
            .setNeutralButton(text, new DialogInterface.OnClickListener() {
                @Override//from www .jav a2 s  .  com
                public void onClick(DialogInterface dialog, int which) {
                    clearError();
                    dialog.dismiss();
                    Intent intent;
                    if (show_instructions) {
                        intent = new Intent(getActivity(), RemediationInstructionsActivity.class);
                        intent.putParcelableArrayListExtra(
                                RemediationInstructionsFragment.EXTRA_REMEDIATION_INSTRUCTIONS,
                                new ArrayList<RemediationInstruction>(instructions));
                    } else {
                        intent = new Intent(getActivity(), LogActivity.class);
                    }
                    startActivity(intent);
                }
            }).setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int id) {
                    clearError();
                    dialog.dismiss();
                }
            }).create();
    mErrorDialog.setOnDismissListener(new DialogInterface.OnDismissListener() {
        @Override
        public void onDismiss(DialogInterface dialog) {
            mErrorDialog = null;
        }
    });
    mErrorDialog.show();
}

From source file:org.gnucash.android.ui.transaction.SplitEditorFragment.java

/**
 * Save all the splits from the split editor
 *//*from   w w w  .  ja  v a2  s .  c  o m*/
private void saveSplits() {
    if (!canSave()) {
        Toast.makeText(getActivity(), R.string.toast_error_check_split_amounts, Toast.LENGTH_SHORT).show();
        return;
    }

    Intent data = new Intent();
    data.putParcelableArrayListExtra(UxArgument.SPLIT_LIST, extractSplitsFromView());
    getActivity().setResult(Activity.RESULT_OK, data);

    getActivity().finish();
}

From source file:com.dycode.jepretstory.mediachooser.fragment.BucketImageFragment.java

private void init() {
    final String orderBy = MediaStore.Images.Media.DATE_TAKEN;
    mCursor = getActivity().getContentResolver().query(MediaStore.Images.Media.EXTERNAL_CONTENT_URI,
            PROJECTION_BUCKET, null, null, orderBy + " DESC");
    ArrayList<BucketEntry> buffer = new ArrayList<BucketEntry>();
    try {/*from w  w  w  . j a  v a 2  s .  com*/
        while (mCursor.moveToNext()) {
            BucketEntry entry = new BucketEntry(mCursor.getInt(INDEX_BUCKET_ID),
                    mCursor.getString(INDEX_BUCKET_NAME), mCursor.getString(INDEX_BUCKET_URL));

            if (!buffer.contains(entry)) {
                buffer.add(entry);
            }
        }

        if (mCursor.getCount() > 0) {
            mBucketAdapter = new BucketGridAdapter(getActivity(), 0, buffer, false);
            mGridView.setAdapter(mBucketAdapter);
        } else {
            Toast.makeText(getActivity(), getActivity().getString(R.string.no_media_file_available),
                    Toast.LENGTH_SHORT).show();
        }

        mGridView.setOnItemClickListener(new OnItemClickListener() {

            @Override
            public void onItemClick(AdapterView<?> adapter, View view, int position, long id) {

                BucketEntry bucketEntry = (BucketEntry) adapter.getItemAtPosition(position);
                Intent selectImageIntent = new Intent(getActivity(), HomeFragmentActivity.class);
                selectImageIntent.putExtra("name", bucketEntry.bucketName);
                selectImageIntent.putExtra("image", true);
                selectImageIntent.putExtra("isFromBucket", true);
                if (mCurrentSelectedImages != null) {
                    selectImageIntent.putParcelableArrayListExtra("selectedImages", mCurrentSelectedImages);
                }

                getActivity().startActivityForResult(selectImageIntent,
                        MediaChooserConstants.BUCKET_SELECT_IMAGE_CODE);
            }
        });

    } finally {
        mCursor.close();
    }
}

From source file:com.germainz.identiconizer.ContactsListActivity.java

private void startIdenticonService(int serviceType) {
    int displayName = mCursor.getColumnIndexOrThrow(ContactsContract.Contacts.DISPLAY_NAME);
    ArrayList<ContactInfo> contactsList = new ArrayList<>();
    int contactId = mCursor.getColumnIndexOrThrow("name_raw_contact_id");
    mCursor.moveToPosition(-1);/*w  ww . j a v a  2s .c o m*/
    while (mCursor.moveToNext()) {
        if (checkedItems.contains(mCursor.getPosition()))
            contactsList.add(new ContactInfo(mCursor.getInt(contactId), mCursor.getString(displayName)));
    }
    Intent intent = null;
    switch (serviceType) {
    case SERVICE_ADD:
        intent = new Intent(this, IdenticonCreationService.class);
        break;
    case SERVICE_REMOVE:
        intent = new Intent(this, IdenticonRemovalService.class);
        break;
    }
    intent.putParcelableArrayListExtra("contactsList", contactsList);
    startService(intent);
}