Example usage for android.content Intent getParcelableExtra

List of usage examples for android.content Intent getParcelableExtra

Introduction

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

Prototype

public <T extends Parcelable> T getParcelableExtra(String name) 

Source Link

Document

Retrieve extended data from the intent.

Usage

From source file:com.bayapps.android.robophish.ui.MusicPlayerActivity.java

private void startFullScreenActivityIfNeeded(Intent intent) {
    if (intent != null && intent.getBooleanExtra(EXTRA_START_FULLSCREEN, false)) {
        Intent fullScreenIntent = new Intent(this, FullScreenPlayerActivity.class)
                .setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_CLEAR_TOP)
                .putExtra(EXTRA_CURRENT_MEDIA_DESCRIPTION,
                        intent.getParcelableExtra(EXTRA_CURRENT_MEDIA_DESCRIPTION));
        startActivity(fullScreenIntent);
    }//www.j a  v  a 2s  . c om
}

From source file:com.geoffreybuttercrumbs.arewethereyet.ZonePicker.java

protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    int received_Set_Ringtone = 131072;
    int set_Pinned = 1;
    if (requestCode == received_Set_Ringtone && resultCode == RESULT_OK) {
        uri = data.getParcelableExtra(RingtoneManager.EXTRA_RINGTONE_PICKED_URI);
        if (uri != null) {
            Toast.makeText(this, "Setting ringtone", Toast.LENGTH_LONG).show();
        } else/*from  www  .j  a v  a  2s . c  om*/
            Toast.makeText(this, "Ringtone: Silent", Toast.LENGTH_LONG).show();
    } else if (requestCode == 10001) {
        TextView donateView = (TextView) mFrag.getView().findViewById(R.id.row_title_donate);
        if (donateView != null) {
            donateView.setText("Thanks!");
            donateView.setBackgroundColor(0xFF11FF11);
        }
    } else if (requestCode == set_Pinned && resultCode == RESULT_OK) {
        if (data.getExtras() != null) {
            setNewAlarmZone(data.getExtras());
        }
    }
}

From source file:com.putlocker.upload.DownloadService.java

private void handleUploadIntent(Intent intent) {
    final PutlockerUploadJob job = intent.getParcelableExtra(JOB_EXTRA_UPLOAD);
    if (cancelledJobs.get(job.getGlobalId()) != null) {
        cancelledJobs.remove(job.getGlobalId());
    } else {/*w  w  w .  j  av  a  2 s . com*/
        _download.put((long) job.getGlobalId(), job);
        RequestCallback callback = new RequestCallback() {

            @Override
            public void requestSuccess(HttpFetch fetch) {
                job.setStatus(DownloadStatus.JobSucess);
                setPutlockerJobStatus(job, DownloadStatus.JobSucess);
                _download.remove(job.getGlobalId());
            }

            @Override
            public void requestRetry(HttpFetch fetch) {
            }

            @Override
            public void requestFailure(HttpFetch fetch) {
                job.setStatus(DownloadStatus.JobError);
                setPutlockerJobStatus(job, DownloadStatus.JobError);
                _download.remove(job.getGlobalId());
                _mainThread.post(new Runnable() {

                    @Override
                    public void run() {
                        Toast.makeText(getApplicationContext(), R.string.download_failed, Toast.LENGTH_LONG);
                    }
                });

            }
        };
        PutlockerUploadFile file = new PutlockerUploadFile(job, callback, this);

        runningJobs.append(job.getGlobalId(), file);
        file.run();
        runningJobs.remove(job.getGlobalId());

        if (file.getStatus().equals(RequestStatus.RequestStatusCanceled)) {
            job.setStatus(DownloadStatus.JobError);
            setPutlockerJobStatus(job, DownloadStatus.JobError);
        }
    }
    downloadJobs.remove(job.getGlobalId());
    mNM.cancel(job.getGlobalId());

    // We are going to stop the foreground services
    if (downloadJobs.size() == 0) {
        stopForeground(true);
    }
    doCompleteNotification(job, job.getStatus());
}

From source file:com.nxp.nfc_demo.activities.MainActivity.java

public void doProcess(Intent nfc_intent) {
    mIntent = nfc_intent;/*  ww  w.  j a  v  a 2 s  .co  m*/
    Tag tag = nfc_intent.getParcelableExtra(NfcAdapter.EXTRA_TAG);
    demo = new Ntag_I2C_Demo(tag, this, mPassword, mAuthStatus);
    if (demo.isReady()) {
        // Retrieve Auth Status before doing any operation
        mAuthStatus = obtainAuthStatus();
        String currTab = mTabHost.getCurrentTabTag();
        launchDemo(currTab);
    }
}

From source file:org.klnusbaum.udj.EventListFragment.java

public void onActivityResult(int requestCode, int resultCode, Intent data) {
    switch (requestCode) {
    case ACCOUNT_CREATION:
        if (resultCode == Activity.RESULT_OK) {
            account = (Account) data.getParcelableExtra(Constants.ACCOUNT_EXTRA);
        } else {/*from w  w w.ja v a  2s . c  o  m*/
            getActivity().setResult(Activity.RESULT_CANCELED);
            getActivity().finish();
        }
        break;
    }
}

From source file:semanticweb.hws14.movapp.activities.MovieDetail.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
    setContentView(R.layout.activity_movie_detail);
    getActionBar().setDisplayHomeAsUpEnabled(false);
    initDetailView();//  w  w  w  . j a va2 s .c  om

    Intent intent = getIntent();
    Movie movie = intent.getParcelableExtra("movie");
    MovieDet movieD = new MovieDet(movie);
    if (movie.equals(staticMovie)) {
        movie.geteListener().onFinished(movieDet);
    } else {
        staticMovie = movie;
        q = new queryForMovieData();
        q.execute(movieD);
    }

    movieD.setOnFinishedEventListener(new EventListener() {
        @Override
        public void onFinished(final MovieDet movie) {
            movieDet = movie;
            //for the async HttpRequester
            staticRequestCanceled = false;
            setData(movie);
        }
    });
}

From source file:com.meetingninja.csse.tasks.TasksFragment.java

@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
    if (resultCode == Activity.RESULT_OK) {
        if (requestCode == 6) {
            refreshTasks();// ww w .j ava 2 s .  c o  m
        } else if (requestCode == 7) {
            Task t = data.getParcelableExtra(Keys.Task.PARCEL);
            t.setCreatedBy(session.getUserID());
            creator.createTask(t);
        }
    }
}

From source file:com.owncloud.android.ui.activity.MoveActivity.java

@Override
public void onClick(View v) {
    if (v == mCancelBtn) {
        finish();/*from   w w w .jav  a  2  s  . co m*/
    } else if (v == mChooseBtn) {
        Intent i = getIntent();
        OCFile targetFile = (OCFile) i.getParcelableExtra(MoveActivity.EXTRA_TARGET_FILE);

        Intent data = new Intent();
        data.putExtra(EXTRA_CURRENT_FOLDER, getCurrentFolder());
        data.putExtra(EXTRA_TARGET_FILE, targetFile);
        setResult(RESULT_OK_AND_MOVE, data);
        finish();
    }
}

From source file:ar.com.iron.android.extensions.connections.InetDataClient.java

/**
 * Invocado cuando hay cambios de conectividad en la plataforma
 * //from w  w w  .j  a  v a2s  . co  m
 * @param intent
 *            Intent con los datos del cambio
 */
protected void onConnectivityChanged(Intent intent) {
    boolean connectivityLoosed = intent.getBooleanExtra(ConnectivityManager.EXTRA_NO_CONNECTIVITY, false);
    boolean hadConnectivity = this.hasConnectivity.get();
    this.hasConnectivity.set(!connectivityLoosed);
    if (connectivityListener != null && hadConnectivity == connectivityLoosed) {
        // Es un cambio de estado, tenemos que notificarlo
        NetworkInfo network = intent.getParcelableExtra(ConnectivityManager.EXTRA_NETWORK_INFO);
        connectivityListener.onConnectivityChanged(!connectivityLoosed, network);
    }
}

From source file:com.google.android.apps.muzei.gallery.GalleryArtSource.java

@Override
protected void onHandleIntent(Intent intent) {
    super.onHandleIntent(intent);
    if (intent != null && ACTION_PUBLISH_NEXT_GALLERY_ITEM.equals(intent.getAction())) {
        Uri forceUri = null;/*from  www  . j ava2s.co  m*/
        if (intent.hasExtra(EXTRA_FORCE_URI)) {
            forceUri = intent.getParcelableExtra(EXTRA_FORCE_URI);
        }

        publishNextArtwork(forceUri);
    }
}