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.android.calendar.event.EditEventActivity.java

@SuppressWarnings("unchecked")
private ArrayList<ReminderEntry> getReminderEntriesFromIntent() {
    Intent intent = getIntent();
    return (ArrayList<ReminderEntry>) intent.getSerializableExtra(EXTRA_EVENT_REMINDERS);
}

From source file:mobile.client.iot.pzalejko.iothome.mqtt.event.InEventReceiver.java

@Override
public void onReceive(Context context, Intent intent) {
    if (connection.isBound()) {
        final Serializable message = intent.getSerializableExtra(MqttEvent.PAYLOAD);
        if (message instanceof Event) {
            handleEvent(context, (Event) message);
        }/*from   w w w . j  av  a2  s  . c o m*/

        if (!isAlertValueObtained) {
            // send a request which will get a current temperature alert value.
            Event event = new Event(Boolean.TRUE, EventSource.LOCAL,
                    EventType.PUBLISH_TEMPERATURE_ALERT_REQUEST);
            Intent outIntent = new Intent(MqttEvent.EVENT_OUT);
            outIntent.putExtra(MqttEvent.PAYLOAD, event);
            broadcaster.sendBroadcast(outIntent);
        }
    }
}

From source file:com.mobizi.passwordmanager.AccountActivity.java

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

    Intent i = getIntent();
    Account account = (Account) i.getParcelableExtra("ACCOUNT");
    AccountType type = account == null ? (AccountType) i.getSerializableExtra("TYPE")
            : account.getAccountType();/*from  w  w  w . ja va  2s  .c  o m*/

    if (savedInstanceState == null) {
        displayFrag = AccountFragmentFactory.getAccountFragment(type);
        displayFrag.setAccount(account);
        FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
        ft.replace(R.id.content_frame, displayFrag, type.toString());
        ft.commit();
    }
}

From source file:com.lillicoder.newsblurry.stories.StoryFragment.java

@Override
public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);

    Intent intent = this.getActivity().getIntent();
    if (intent != null && intent.hasExtra(StoryActivity.INTENT_STORY_TO_DISPLAY)) {
        Story story = (Story) intent.getSerializableExtra(StoryActivity.INTENT_STORY_TO_DISPLAY);
        this.displayStory(story);
    }/*  ww w .j  av  a  2s.c o m*/
}

From source file:com.undatech.opaque.AdvancedSettingsActivity.java

@Override
public void onCreate(Bundle icicle) {
    super.onCreate(icicle);
    setContentView(R.layout.advanced_settings_activity);

    Intent i = getIntent();
    currentConnection = (ConnectionSettings) i.getSerializableExtra("com.undatech.opaque.ConnectionSettings");

    toggleAudioPlayback = (ToggleButton) findViewById(R.id.toggleAudioPlayback);
    toggleAudioPlayback.setChecked(currentConnection.isAudioPlaybackEnabled());

    toggleAutoRotation = (ToggleButton) findViewById(R.id.toggleAutoRotation);
    toggleAutoRotation.setChecked(currentConnection.isRotationEnabled());

    toggleAutoRequestDisplayResolution = (ToggleButton) findViewById(R.id.toggleAutoRequestDisplayResolution);
    toggleAutoRequestDisplayResolution.setChecked(currentConnection.isRequestingNewDisplayResolution());

    toggleSslStrict = (ToggleButton) findViewById(R.id.toggleSslStrict);
    toggleSslStrict.setChecked(currentConnection.isSslStrict());

    toggleUsingCustomOvirtCa = (ToggleButton) findViewById(R.id.toggleUsingCustomOvirtCa);
    toggleUsingCustomOvirtCa.setChecked(currentConnection.isUsingCustomOvirtCa());

    buttonManageOvirtCa = (Button) findViewById(R.id.buttonManageOvirtCa);
    buttonManageOvirtCa.setEnabled(currentConnection.isUsingCustomOvirtCa());

    // Send the generated data back to the calling activity.
    Intent databackIntent = new Intent();
    databackIntent.putExtra("com.undatech.opaque.ConnectionSettings", currentConnection);
    setResult(Activity.RESULT_OK, databackIntent);
}

From source file:com.lillicoder.newsblurry.stories.StoriesActivity.java

/**
 * Gets the {@link Feed} contained in the given {@link Intent} under the
 * {@link #INTENT_FEED_TO_DISPLAY} key./*w ww.  j  a va2  s .  c  om*/
 * @param intent {@link Intent} to get the feed from.
 * @return {@link Feed} contained in the given intent,
 *          <code>null</code> if there was no feed found.
 */
private Feed getFeedFromIntent(Intent intent) {
    Feed feed = null;

    if (intent != null && intent.hasExtra(INTENT_FEED_TO_DISPLAY))
        feed = (Feed) intent.getSerializableExtra(INTENT_FEED_TO_DISPLAY);

    return feed;
}

From source file:com.ccwant.photo.selector.activity.CCwantPhotoBrowserActivity.java

private void steupPhotoToListView() {
    Intent intent = getIntent();
    mData = (List<String>) intent.getSerializableExtra("CCwantPhotoList");
    mPosition = (int) intent.getSerializableExtra("CCwantPhotoPosition");
    mData.remove("default");
    for (int i = 0; i < mData.size(); i++) {
        initListViews(mData.get(i));//  w ww.  j ava  2 s .  c o m
    }
}

From source file:com.xandy.calendar.event.EditEventActivity.java

@SuppressWarnings("unchecked")
private ArrayList<CalendarEventModel.ReminderEntry> getReminderEntriesFromIntent() {
    Intent intent = getIntent();
    return (ArrayList<CalendarEventModel.ReminderEntry>) intent.getSerializableExtra(EXTRA_EVENT_REMINDERS);
}

From source file:org.matrix.console.activity.ImageSliderActivity.java

@Override
public void onCreate(Bundle savedInstanceState) {

    if (CommonActivityUtils.shouldRestartApp()) {
        CommonActivityUtils.restartApp(this);
    }/* w w  w . j  av a  2 s. co m*/

    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_images_slider);

    ViewPager viewPager = (ViewPager) findViewById(R.id.view_pager);

    final Intent intent = getIntent();

    List<SlidableImageInfo> listImageMessages = (List<SlidableImageInfo>) intent
            .getSerializableExtra(KEY_INFO_LIST);
    int position = intent.getIntExtra(KEY_INFO_LIST_INDEX, 0);
    int maxImageWidth = intent.getIntExtra(KEY_THUMBNAIL_WIDTH, 0);
    int maxImageHeight = intent.getIntExtra(ImageSliderActivity.KEY_THUMBNAIL_HEIGHT, 0);

    MXSession session = getSession(intent);
    HomeserverConnectionConfig hsConfig = session != null ? session.getHomeserverConfig() : null;

    ImagesSliderAdapter adapter = new ImagesSliderAdapter(this, hsConfig, listImageMessages, maxImageWidth,
            maxImageHeight);
    viewPager.setAdapter(adapter);
    viewPager.setCurrentItem(position);
    viewPager.setPageTransformer(true, new DepthPageTransformer());
}

From source file:org.huxizhijian.hhcomicviewer.ui.recommend.ComicShowActivity.java

private void initViews() {
    mBinding.tabs.setTabMode(TabLayout.MODE_SCROLLABLE);
    mTabLists = new ArrayList<>();
    mFragments = new ArrayList<>();
    Intent intent = getIntent();
    for (int i = 0; i < 5; i++) {
        ComicTabList comicTabList = (ComicTabList) intent.getSerializableExtra("tab_list_" + i);
        mTabLists.add(comicTabList);//from  ww w.  ja v a2s .  co m
        mBinding.tabs.addTab(mBinding.tabs.newTab().setText(comicTabList.getTabName()), i);
        RecommendDetailsFragment fragment = new RecommendDetailsFragment();
        Bundle bundle = new Bundle();
        bundle.putSerializable("tab_list", comicTabList);
        fragment.setArguments(bundle);
        mFragments.add(fragment);
    }
    mBinding.viewPager.setAdapter(new TabFragmentPagerAdapter(getSupportFragmentManager()));
    mBinding.tabs.setTabTextColors(getResources().getColor(R.color.gray_200),
            getResources().getColor(R.color.white));
    mBinding.tabs.setupWithViewPager(mBinding.viewPager);
    mBinding.viewPager.setCurrentItem(intent.getIntExtra("page", 0), false);
}