Example usage for android.content Intent getParcelableArrayListExtra

List of usage examples for android.content Intent getParcelableArrayListExtra

Introduction

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

Prototype

public <T extends Parcelable> ArrayList<T> getParcelableArrayListExtra(String name) 

Source Link

Document

Retrieve extended data from the intent.

Usage

From source file:org.mozilla.mozstumbler.service.stumblerthread.Reporter.java

private void receivedCellMessage(Intent intent) {
    List<CellInfo> results = intent.getParcelableArrayListExtra(CellScanner.ACTION_CELLS_SCANNED_ARG_CELLS);
    putCellResults(results);/*  www . ja  va2s.  c  o m*/
}

From source file:org.mozilla.mozstumbler.service.stumblerthread.Reporter.java

private void receivedWifiMessage(Intent intent) {
    List<ScanResult> results = intent.getParcelableArrayListExtra(WifiScanner.ACTION_WIFIS_SCANNED_ARG_RESULTS);
    putWifiResults(results);//from  ww  w. j  a va 2  s  .  c om
}

From source file:com.yibingding.haolaiwu.ViewPagerActivity.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    requestWindowFeature(Window.FEATURE_NO_TITLE);

    Intent in = getIntent();
    String string = in.getStringExtra("type");
    if (TextUtils.equals("", string)) {
        adinfos = in.getParcelableArrayListExtra("adinfos");
        Log.e("=============", "===========adinfos.size()===" + adinfos.size());
    } else {/*  www . j a  v a2s  .co m*/
        list = in.getStringArrayListExtra("list");
        Log.e("=============", "========list.size()==" + list.size());
    }
    int position = getIntent().getIntExtra("position", 0);

    mViewPager = new HackyViewPager(this);
    mViewPager.setBackgroundColor(getResources().getColor(R.color.black));
    setContentView(mViewPager);

    mViewPager.setAdapter(new SamplePagerAdapter());
    mViewPager.setCurrentItem(position);
}

From source file:com.doctoror.fuckoffmusicplayer.presentation.playback.PlaybackAndroidService.java

private void onActionPlay(@NonNull final Intent intent) {
    final List<Media> queue = intent.getParcelableArrayListExtra(EXTRA_QUEUE);
    final int position = intent.getIntExtra(EXTRA_POSITION, 0);
    service.play(queue, position);/*w ww .  j a v  a2s .c  o m*/
}

From source file:com.cleanwiz.applock.files.activity.PhotoPreViewActivity.java

@Override
protected void onStart() {
    super.onStart();

    Intent intent = getIntent();
    List<HideImageExt> hideImageExt = intent.getParcelableArrayListExtra("list");
    int index = intent.getIntExtra("id", -1);
    mSamplePagerAdapter.setList(hideImageExt);

    if (index != -1)
        mViewPager.setCurrentItem(index);

    mViewpage_title.setVisibility(View.VISIBLE);
}

From source file:com.geomoby.geodeals.notification.CustomNotification.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    //Hide Title Bar
    this.requestWindowFeature(Window.FEATURE_NO_TITLE);

    setContentView(R.layout.geomoby_offer);

    Intent intent = getIntent();

    ArrayList<GeoMessage> geoMessage = intent.getParcelableArrayListExtra("GeoMessage");

    String title = geoMessage.get(0).title;
    String link = geoMessage.get(0).siteURL;
    String image_url = geoMessage.get(0).imageURL;
    String description = geoMessage.get(0).message;
    final double latitude = Double.valueOf(geoMessage.get(0).latitude);
    final double longitude = Double.valueOf(geoMessage.get(0).longitude);
    int notification_id = geoMessage.get(0).id;

    Button btnClose = (Button) findViewById(R.id.close);
    btnClose.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
            // Perform action on click   
            CustomNotification.this.finish();
        }//from  w  w  w  .j av  a  2  s. c  o  m
    });

    Button btnNearest = (Button) findViewById(R.id.nearest);
    btnNearest.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
            SharedPreferences settingsActivity = CustomNotification.this.getSharedPreferences("GeoMobyPrefs",
                    MODE_PRIVATE);
            final double myLatitude = Double.valueOf(settingsActivity.getString(SETTING_LAT, ""));
            final double myLongitude = Double.valueOf(settingsActivity.getString(SETTING_LNG, ""));

            Context context = CustomNotification.this;
            Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://maps.google.com/maps?f=d&saddr="
                    + myLatitude + "," + myLongitude + "&daddr=" + latitude + "," + longitude + "&dirflg=w"));
            intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            context.startActivity(intent);
        }
    });

    Typeface font = Typeface.createFromAsset(getAssets(), "Bitter-Bold.otf");

    TextView tvTitle = (TextView) findViewById(R.id.title);
    tvTitle.setTypeface(font);
    tvTitle.setText(title);

    TextView tvDesc = (TextView) findViewById(R.id.description);
    tvDesc.setTypeface(font);
    tvDesc.setText(description);

    TextView tvLink = (TextView) findViewById(R.id.link);
    tvLink.setTypeface(font);
    String desc = "<a href=\"" + link + "\">Demo Link</a>";
    tvLink.setText(Html.fromHtml(desc));
    tvLink.setMovementMethod(LinkMovementMethod.getInstance());

    // Warning - Big bitmap images might create errors
    if (!image_url.equals(""))
        new DownloadImageTask((ImageView) findViewById(R.id.image)).execute(image_url);

    //Notify GeoMoby server that user has opened the notification
    //new ClickThroughAsyncTask(this).execute(notification_id);
}

From source file:me.fireant.photoselect.ui.PhotoSelectedPreviewActivity.java

@Override
protected void initData() {
    if (getIntent() != null) {
        Intent intent = getIntent();
        mSelectedPhotos = intent.getParcelableArrayListExtra(BUNDLE_SELECTED_PHOTOS);
        mSelectIndex = intent.getIntExtra(BUNDLE_SELECT_INDEX, 0);
    }//from w  ww .  j  av a 2 s  . c  o  m

    if (mSelectedPhotos == null || mSelectedPhotos.isEmpty()) {
        throw new IllegalStateException("selectPhotos must > 0");
    }

    mPagerAdapter = new PagerAdapter() {
        @Override
        public int getCount() {
            return mSelectedPhotos.size();
        }

        @Override
        public boolean isViewFromObject(View view, Object object) {
            return view == object;
        }

        @Override
        public void destroyItem(ViewGroup container, int position, Object object) {
            container.removeView((View) object);
        }

        @Override
        public int getItemPosition(Object object) {
            return POSITION_NONE;
        }

        @Override
        public Object instantiateItem(ViewGroup container, int position) {
            View rootView = LayoutInflater.from(PhotoSelectedPreviewActivity.this)
                    .inflate(R.layout.list_cell_photo_preview, null);
            final ImageView photoView = (ImageView) rootView.findViewById(R.id.iv_photo);
            final ProgressBar pbLoading = (ProgressBar) rootView.findViewById(R.id.pb_loading);
            final Photo photo = mSelectedPhotos.get(position);

            Picasso.with(PhotoSelectedPreviewActivity.this).load(new File(photo.getPath()))
                    .error(R.drawable.ic_photo_error).into(photoView, new Callback() {
                        @Override
                        public void onSuccess() {
                            photoView.setVisibility(View.VISIBLE);
                            pbLoading.setVisibility(View.GONE);
                        }

                        @Override
                        public void onError() {

                        }
                    });

            container.addView(rootView);

            return rootView;
        }
    };

    mViewPager.setAdapter(mPagerAdapter);

    mViewPager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() {
        @Override
        public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {

        }

        @Override
        public void onPageSelected(int position) {
            mSelectIndex = position + 1;
            setActionTitle();
        }

        @Override
        public void onPageScrollStateChanged(int state) {

        }

    });

    if (mSelectIndex == 0) {
        mSelectIndex = mSelectIndex + 1;
        setActionTitle();
    } else {
        mViewPager.setCurrentItem(mSelectIndex, false);
    }
}

From source file:me.fireant.photoselect.ui.PhotoPreviewActivity.java

@Override
protected void initData() {
    Intent intent = getIntent();
    if (intent != null) {
        mPhotos = intent.getParcelableArrayListExtra(BUNDLE_PHOTOS);
        mSelectIndex = intent.getIntExtra(BUNDLE_SELECT_INDEX, 0);
        mSelectedPhotos = intent.getParcelableArrayListExtra(BUNDLE_SELECTED_PHOTOS);
        mMaxSelectPhotoCount = intent.getIntExtra(BUNDLE_MAX_SELECT_COUNT, 1);
    }/*from  w w w  . ja  va 2  s.  co m*/

    if (mSelectedPhotos == null) {
        mSelectedPhotos = new ArrayList<>();
    }

    mPagerAdapter = new PagerAdapter() {
        @Override
        public int getCount() {
            return mPhotos.size();
        }

        @Override
        public boolean isViewFromObject(View view, Object object) {
            return view == object;
        }

        @Override
        public void destroyItem(ViewGroup container, int position, Object object) {
            container.removeView((View) object);
        }

        @Override
        public Object instantiateItem(ViewGroup container, int position) {
            View rootView = LayoutInflater.from(PhotoPreviewActivity.this)
                    .inflate(R.layout.list_cell_photo_preview, null);
            final ImageView photoView = (ImageView) rootView.findViewById(R.id.iv_photo);
            final ProgressBar pbLoading = (ProgressBar) rootView.findViewById(R.id.pb_loading);
            final Photo photo = mPhotos.get(position);

            Picasso.with(PhotoPreviewActivity.this).load(new File(photo.getPath()))
                    .error(R.drawable.ic_photo_error).into(photoView, new Callback() {
                        @Override
                        public void onSuccess() {
                            photoView.setVisibility(View.VISIBLE);
                            pbLoading.setVisibility(View.GONE);
                        }

                        @Override
                        public void onError() {

                        }
                    });

            container.addView(rootView);

            return rootView;
        }
    };

    mViewPager.setAdapter(mPagerAdapter);

    mViewPager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() {
        @Override
        public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
        }

        @Override
        public void onPageSelected(int position) {
            checkChecked(position);
            mSelectIndex = position + 1;
            setActionTitle();
        }

        @Override
        public void onPageScrollStateChanged(int state) {

        }
    });
    if (mSelectIndex == 0) {
        checkChecked(mSelectIndex);
        mSelectIndex = mSelectIndex + 1;
        setActionTitle();
    } else {
        mViewPager.setCurrentItem(mSelectIndex, false);
    }
}

From source file:ca.hoogit.garagepi.Controls.Doors.java

@Override
public void onReceive(Context context, Intent intent) {
    String action = intent.getStringExtra(Consts.KEY_BROADCAST_ACTION);
    if (Consts.ACTION_DOORS_QUERY.equals(action)) {
        boolean wasSuccess = intent.getBooleanExtra(Consts.KEY_BROADCAST_SUCCESS, false);
        if (wasSuccess) {
            this.mDoors = intent.getParcelableArrayListExtra(Consts.KEY_DOORS);
        }//from  w  w w. j ava  2 s . c  om
    }
}

From source file:com.perm.DoomPlay.ListVkActivity.java

@Override
protected void onNewIntent(Intent intent) {
    super.onNewIntent(intent);
    setIntent(intent);/*w w w  .  j  a  va 2 s.com*/
    ArrayList<Audio> tempTracks = intent.getParcelableArrayListExtra(MainScreenActivity.keyOpenInListTrack);

    if (tempTracks != null) {
        audios = tempTracks;
        adapter.changeData(audios);
    }
    currentAction = intent.getAction();
}