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:ru.tinkoff.acquiring.sdk.PayFormActivity.java

public static void dispatchResult(int resultCode, Intent data, OnPaymentListener listener) {
    if (resultCode == RESULT_OK) {
        listener.onSuccess(data.getLongExtra(EXTRA_PAYMENT_ID, -1L));
    } else if (resultCode == RESULT_CANCELED) {
        listener.onCancelled();/*from   w  w  w  .ja  va 2 s  .c o  m*/
    } else if (resultCode == RESULT_ERROR) {
        listener.onError((Exception) data.getSerializableExtra(EXTRA_ERROR));
    }
}

From source file:cat.ereza.customactivityoncrash.CustomActivityOnCrash.java

/**
 * Given an Intent, returns the event listener extra from it.
 *
 * @param intent The Intent. Must not be null.
 * @return The event listener, or null if not provided.
 *//*w w  w . ja v a  2s  .  com*/
@SuppressWarnings("unchecked")
public static EventListener getEventListenerFromIntent(Intent intent) {
    Serializable serializedClass = intent.getSerializableExtra(CustomActivityOnCrash.EXTRA_EVENT_LISTENER);

    if (serializedClass != null && serializedClass instanceof EventListener) {
        return (EventListener) serializedClass;
    } else {
        return null;
    }
}

From source file:cat.ereza.customactivityoncrash.CustomActivityOnCrash.java

/**
 * Given an Intent, returns the restart activity class extra from it.
 *
 * @param intent The Intent. Must not be null.
 * @return The restart activity class, or null if not provided.
 *///from   w  ww.  j  a v  a 2 s . co  m
@SuppressWarnings("unchecked")
public static Class<? extends Activity> getRestartActivityClassFromIntent(Intent intent) {
    Serializable serializedClass = intent
            .getSerializableExtra(CustomActivityOnCrash.EXTRA_RESTART_ACTIVITY_CLASS);

    if (serializedClass != null && serializedClass instanceof Class) {
        return (Class<? extends Activity>) serializedClass;
    } else {
        return null;
    }
}

From source file:org.linphone.LinphoneService.java

public final static SmsMessage[] getMessagesFromIntent(Intent intent) {
    Object[] messages = (Object[]) intent.getSerializableExtra("pdus");
    byte[][] pduObjs = new byte[messages.length][];
    for (int i = 0; i < messages.length; i++) {
        pduObjs[i] = (byte[]) messages[i];
    }/* w  w w . j  a v a2 s  .  com*/

    byte[][] pdus = new byte[pduObjs.length][];
    int pduCount = pdus.length;
    SmsMessage[] msgs = new SmsMessage[pduCount];

    for (int i = 0; i < pduCount; i++) {
        pdus[i] = pduObjs[i];
        //         msgs[i] = SmsMessage.createFromPdu(pdus[i]);
    }

    return msgs;
}

From source file:com.boostcamp.eunjilee.innerbeauty.DetailOpenSourceLicenseActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_detail_open_source_license);
    ButterKnife.bind(this);
    ActionBar actionBar = getSupportActionBar();
    actionBar.setDisplayHomeAsUpEnabled(true);
    actionBar.setHomeButtonEnabled(true);
    Intent intent = getIntent();
    mOpenSourceLicense = (OpenSourceLicenseModel) intent.getSerializableExtra("OpenSourceLibrary");
    actionBar.setTitle(mOpenSourceLicense.getLibraryName());
    showOpenSourceLibraryDetail();/*  w w w . j  a v a  2 s  . c o  m*/
}

From source file:com.alex.vmandroid.display.exhibition.history.details.HistoricalDetailsActivity.java

@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_historical_details);

    Intent intent = getIntent();
    mHistory = (History) intent.getSerializableExtra("HistoryData");

    showHistoricalDetailsFragment();//from   ww  w.j  a v a 2s  .  c om

    showChartFragment();
}

From source file:com.nadmm.airports.tfr.TfrImageService.java

private void getTfrImage(Intent intent) {
    Tfr tfr = (Tfr) intent.getSerializableExtra(TFR_ENTRY);
    String notamId = tfr.notamId;
    int start = notamId.indexOf(' ');
    if (start > 0) {
        notamId = notamId.substring(start + 1);
    }//  w w w.j  ava2s. c  o m
    notamId = notamId.replace("/", "_");

    String name = "sect_" + notamId + ".gif";
    File imageFile = getFile(name);

    if (!imageFile.exists()) {
        URI uri;
        try {
            uri = URIUtils.createURI("http", TFR_HOST, 80, TFR_PATH + "/" + name, null, null);
            fetch(uri, imageFile);
        } catch (URISyntaxException e) {
            UiUtils.showToast(this, "TFR: " + e.getMessage());
        }
    }

    Intent result = makeResultIntent(intent.getAction());
    if (imageFile.exists()) {
        result.putExtra(TFR_IMAGE_PATH, imageFile.getAbsolutePath());
    }
    sendResultIntent(result);
}

From source file:touchgallery.GalleryUrlActivity.java

public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    setContentView(R.layout.activity_gallery_url);
    Intent intent = getIntent();
    UsedBookInfo book = (UsedBookInfo) intent.getSerializableExtra("book");
    List<String> items = book.getOriginalPhotoURL();

    UrlPagerAdapter pagerAdapter = new UrlPagerAdapter(this, items, mBitmapCache);
    //        pagerAdapter.setOnItemChangeListener(new OnItemChangeListener()
    //      {/*w ww . ja va  2s  .  co m*/
    //         @Override
    //         public void onItemChange(int currentPosition)
    //         {
    //            Toast.makeText(GalleryUrlActivity.this, "Current item is " + currentPosition, Toast.LENGTH_SHORT).show();
    //         }
    //      });

    mViewPager = (GalleryViewPager) findViewById(R.id.viewer);
    mViewPager.setOffscreenPageLimit(3);
    mViewPager.setAdapter(pagerAdapter);

}

From source file:org.montanafoodhub.app.FragmentBase.java

private BroadcastReceiver getBroadcastReceiver() {
    return new BroadcastReceiver() {
        @Override/*from ww  w . j  av  a2 s  .  c  o  m*/
        public void onReceive(Context context, Intent intent) {
            HubInit.HubType type = (HubInit.HubType) intent.getSerializableExtra(Hub.EXTRA_HUB_TYPE);

            // due to the async nature of the broadcast message it is possible to receive this after we have unregistered
            if ((type == _hubType) && (_receiverRegistered == true)) {
                onRefresh();
            }
        }
    };
}

From source file:com.gcssloop.diycode.activity.MyTopicActivity.java

@Override
protected void initDatas() {
    mDiycode = Diycode.getSingleInstance();
    mDataCache = new DataCache(this);
    Intent intent = getIntent();
    InfoType type = (InfoType) intent.getSerializableExtra("type");
    if (type != null) {
        current_type = type;//from  www .  ja  v a  2  s .  c  o  m
    } else {
        current_type = InfoType.MY_TOPIC;
    }
}