Example usage for android.content Intent getSerializableExtra

List of usage examples for android.content Intent getSerializableExtra

Introduction

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

Prototype

public Serializable getSerializableExtra(String name) 

Source Link

Document

Retrieve extended data from the intent.

Usage

From source file:com.scooter1556.sms.android.activity.VideoPlayerActivity.java

@Override
public void onResume() {
    super.onResume();

    controller.setVisibility(View.VISIBLE);
    showController = true;//from   ww w .  j  av a 2  s . c o m

    // Hide action bar
    surface.setSystemUiVisibility(View.SYSTEM_UI_FLAG_FULLSCREEN);

    // Retrieve media element to play
    Intent intent = getIntent();
    mediaElement = (MediaElement) intent.getSerializableExtra("mediaElement");

    // If our surface is ready start playing video (surface is not destroyed if the power button is pressed)
    if (ready) {
        preparePlayer();
    }
}

From source file:org.ohmage.auth.AuthenticatorTest.java

public void testGetAuthToken_userRecoverableErrorWhenAuthtokenFromGoogle_sendsErrorViaIntent()
        throws Exception {
    setAuthTokenCached(false);//from ww  w .  ja  va  2s.  c  om
    setAccountRefreshToken();
    setAccessTokenFailure(refreshToken, new AuthenticationException(""));
    setHasGoogleAccount(true);
    UserRecoverableAuthException fakeException = new UserRecoverableAuthException("msg", new Intent());
    setGetGoogleAuthTokenResult(fakeException);

    Bundle data = mAuthenticator.getAuthToken(null, fakeAccount, AuthUtil.AUTHTOKEN_TYPE, null);

    Intent intent = data.getParcelable(AccountManager.KEY_INTENT);
    assertNotNull(intent);
    assertEquals(intent.getComponent().getClassName(), AuthenticatorActivity.class.getName());
    assertEquals(fakeException,
            intent.getSerializableExtra(AuthenticatorActivity.EXTRA_HANDLE_USER_RECOVERABLE_ERROR));
}

From source file:com.project.salminnella.prescoop.activity.SchoolDetailsActivity.java

/**
 * Receives Intent data from MainActivity or the Map Fragment.  The Preschool object is used
 * to populate the rest of the school details.
 *///from  w  w  w.  ja va 2 s .co  m
private void receiveIntent() {
    Intent receiveIntent = getIntent();
    mPreschool = (PreSchool) receiveIntent.getSerializableExtra(Constants.SCHOOL_OBJECT_KEY);
}

From source file:net.dian1.player.service.DownloadService.java

@Override
public int onStartCommand(Intent intent, int flags, int startId) {
    super.onStartCommand(intent, flags, startId);

    if (intent == null) {
        return START_NOT_STICKY;
    }//from   ww w  .  ja  v a 2s  .  c o  m

    String action = intent.getAction();
    Log.i(Dian1Application.TAG, "DownloadService.onStart - " + action);

    if (action.equals(ACTION_ADD_TO_DOWNLOAD)) {
        PlaylistEntry entry = (PlaylistEntry) intent.getSerializableExtra(EXTRA_PLAYLIST_ENTRY);
        addToDownloadQueue(entry, startId);
    }
    return super.onStartCommand(intent, flags, startId);
}

From source file:com.github.mobile.ui.gist.GistFragment.java

@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
    if (RESULT_OK == resultCode && COMMENT_CREATE == requestCode && data != null) {
        Comment comment = (Comment) data.getSerializableExtra(EXTRA_COMMENT);
        if (comments != null) {
            comments.add(comment);/*from ww  w .ja v a 2s.c  o m*/
            gist.setComments(gist.getComments() + 1);
            updateList(gist, comments);
        } else
            refreshGist();
        return;
    }

    super.onActivityResult(requestCode, resultCode, data);
}

From source file:com.yandex.speechkit.recognizeractivitysample.RecognizerUISampleFragment.java

@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, requestCode, data);
    if (requestCode == REQUEST_CODE) {
        if (resultCode == RecognizerActivity.RESULT_OK && data != null) {
            final String result = data.getStringExtra(RecognizerActivity.EXTRA_RESULT);
            updateTextResult(result);/*from   w ww . j av  a  2 s .c  o  m*/
        } else if (resultCode == RecognizerActivity.RESULT_ERROR) {
            String error = ((ru.yandex.speechkit.Error) data
                    .getSerializableExtra(RecognizerActivity.EXTRA_ERROR)).getString();
            updateTextResult(error);
        }
    }
}

From source file:eu.faircode.netguard.SinkholeService.java

@Override
public int onStartCommand(Intent intent, int flags, int startId) {
    // Get command
    final Command cmd = (intent == null ? Command.start : (Command) intent.getSerializableExtra(EXTRA_COMMAND));
    Log.i(TAG, "Start intent=" + intent + " command=" + cmd + " vpn=" + (vpn != null));

    // Queue command
    Message msg = mServiceHandler.obtainMessage();
    msg.arg1 = startId;/* w w  w.j av  a 2 s  .  c  om*/
    msg.obj = intent;
    mServiceHandler.sendMessage(msg);

    return START_STICKY;
}

From source file:com.sharespirit.udghosh2.ImagePagerActivity.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.ac_image_pager);

    prefs = getSharedPreferences(MainActivity.class.getSimpleName(), Context.MODE_PRIVATE);

    Intent in = getIntent();
    //assert bundle != null;
    ArrayList<HashMap<String, String>> imageUrls = (ArrayList<HashMap<String, String>>) getIntent()
            .getSerializableExtra(Config.IMAGES);
    int pagerPosition = (Integer) in.getSerializableExtra(Config.IMAGE_POSITION);

    if (savedInstanceState != null) {
        pagerPosition = savedInstanceState.getInt(STATE_POSITION);
    }//from  w  w  w.  ja  v  a 2 s .  c o m

    options = new DisplayImageOptions.Builder().showImageForEmptyUri(R.drawable.ic_empty)
            .showImageOnFail(R.drawable.ic_error).resetViewBeforeLoading(true).cacheOnDisk(true)
            .imageScaleType(ImageScaleType.EXACTLY).bitmapConfig(Bitmap.Config.RGB_565).considerExifParams(true)
            .displayer(new FadeInBitmapDisplayer(300)).build();

    pager = (ViewPager) findViewById(R.id.pager);
    pager.setAdapter(new ImagePagerAdapter(imageUrls));
    pager.setCurrentItem(pagerPosition);
    pager.setDrawingCacheEnabled(true);

    pager.buildDrawingCache(true);

    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
}

From source file:com.paramedic.mobshaman.fragments.AccionesDetalleServicioFragment.java

private void getServicioFromIntent() {
    Intent intent = this.getActivity().getIntent();
    serv = (Servicio) intent.getSerializableExtra("Servicio");
}

From source file:nhannt.musicplayer.ui.home.HomeActivity.java

private void doMainWork() {
    navigationView.getMenu().getItem(0).setChecked(true);
    showFragment(FragmentMain.newInstance(), FragmentMain.TAG);
    btnTogglePlay.setOnClickListener(mPresenter);
    currentPlayBar.setOnClickListener(mPresenter);
    setupSearchView();/*from  w w  w  .  jav  a  2 s  . c o  m*/
    Intent intent = getIntent();
    switch (intent.getAction()) {
    case ACTION_OPEN_ALBUM_DETAIL:
        Album album = (Album) intent.getSerializableExtra(KEY_ALBUM_DETAIL);
        Navigator.navigateToAlbumDetail(this, album, null);
        break;
    case ACTION_OPEN_ARTIST_DETAIL:
        Artist artist = (Artist) intent.getSerializableExtra(KEY_ARTIST_DETAIL);
        Navigator.navigateToArtistDetail(this, artist, null);
        break;
    }
}