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:org.grameenfoundation.cch.supervisor.activity.ViewNurseActivity.java

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

    Intent i = getIntent();
    nurse = (Nurse) i.getSerializableExtra("nurse");
    refresh();/*  www  .  j  av  a  2  s .  c  om*/
}

From source file:org.grameenfoundation.cch.supervisor.activity.ViewFacilityActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_view_model);
    Intent i = getIntent();
    facility = (Facility) i.getSerializableExtra("facility");
    refresh();/*from   ww w  .  j  a va  2  s .  c om*/
}

From source file:org.grameenfoundation.cch.supervisor.activity.ViewDistrictActivity.java

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

    Intent i = getIntent();
    district = (District) i.getSerializableExtra("district");

    refresh();/*ww w  .j  a v  a 2 s.  c om*/
}

From source file:net.forkk.autocron.EditComponentActivity.java

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

    Intent intent = getIntent();
    assert intent != null;

    ComponentPointer pointer = (ComponentPointer) intent.getSerializableExtra(EXTRA_COMPONENT_POINTER);

    // Hack to get the title to display properly.
    String componentName = "";
    if (pointer instanceof Rule.Pointer)
        componentName = getString(R.string.rule_upper);
    if (pointer instanceof Action.Pointer)
        componentName = getString(R.string.action_upper);
    if (pointer instanceof Trigger.Pointer)
        componentName = getString(R.string.trigger_upper);
    setTitle(getString(R.string.title_activity_edit_component, componentName));

    if (savedInstanceState == null) {
        Bundle fragArgs = new Bundle();
        fragArgs.putSerializable(ComponentPreferenceFragment.VALUE_COMPONENT_POINTER, pointer);

        ComponentPreferenceFragment fragment = new ComponentPreferenceFragment();
        fragment.setArguments(fragArgs);

        FragmentTransaction transaction = getFragmentManager().beginTransaction();
        transaction.replace(R.id.fragment_edit_component_container, fragment);
        transaction.commit();/*from w  ww  .jav  a 2 s. c  o m*/
    }
}

From source file:com.suwonsmartapp.tourlist.imageviewer.ImageViewer.java

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

    setContentView(R.layout.activity_imageviewer);

    Intent intent = getIntent();
    if (intent != null) {
        Serializable data = intent.getSerializableExtra("imageList");
        if (data instanceof ArrayList) {
            ImagePagerAdapter adapter = new ImagePagerAdapter(getSupportFragmentManager(), (ArrayList) data);

            ((ViewPager) findViewById(R.id.pager)).setAdapter(adapter);
        }/*from w  w w .ja v  a  2s.c  om*/
    }

}

From source file:ru.tinkoff.acquiring.sample.ui.PaymentResultActivity.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_payment_result);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);

    final TextView textView = (TextView) findViewById(R.id.tv_confirm);
    Intent intent = getIntent();
    if (intent.hasExtra(EXTRA_PRICE)) {
        final Money price = (Money) intent.getSerializableExtra(EXTRA_PRICE);

        final SpannableString coloredPrice = new SpannableString(price.toString());
        coloredPrice.setSpan(new ForegroundColorSpan(ContextCompat.getColor(this, R.color.colorPrimary)), 0,
                coloredPrice.length(), SpannedString.SPAN_INCLUSIVE_INCLUSIVE);

        final String text = getString(R.string.payment_result_success, coloredPrice);
        textView.setText(text);/*  ww  w .  j a va  2s  .  c om*/
    } else {
        String cardId = intent.getStringExtra(EXTRA_CARD_ID);
        final String text = getString(R.string.attachment_result_success, cardId);
        textView.setText(text);
    }
}

From source file:com.indragie.cmput301as1.ExpenseClaimListActivity.java

/**
 * Sets the active user of the application.
 * @param data The intent to get the user from.
 *///from   ww w.  j a v  a  2  s.c  o m
private void onUserSettingsResult(Intent data) {
    User user = (User) data.getSerializableExtra(UserSettingsActivity.EXTRA_USER);
    boolean noExistingUser = (userManager.getActiveUser() == null);
    userManager.setActiveUser(user);
    if (noExistingUser) {
        setupFragments();
    }
}

From source file:com.lillicoder.newsblurry.feeds.FeedsActivity.java

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

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

    return feed;
}

From source file:im.vector.activity.ImageSliderActivity.java

@Override
public void onCreate(Bundle savedInstanceState) {
    if (CommonActivityUtils.shouldRestartApp()) {
        CommonActivityUtils.restartApp(this);
    }//from   w  w w . ja v  a 2s.  c  o  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);

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

From source file:com.fa.mastodon.activity.AccountListActivity.java

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

    Type type;/* www. j  av a2 s  .  co  m*/
    Intent intent = getIntent();
    if (intent != null) {
        type = (Type) intent.getSerializableExtra("type");
    } else {
        type = Type.BLOCKS;
    }

    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    ActionBar bar = getSupportActionBar();
    if (bar != null) {
        switch (type) {
        case BLOCKS: {
            bar.setTitle(getString(R.string.title_blocks));
            break;
        }
        case MUTES: {
            bar.setTitle(getString(R.string.title_mutes));
            break;
        }
        case FOLLOW_REQUESTS: {
            bar.setTitle(getString(R.string.title_follow_requests));
            break;
        }
        }
        bar.setDisplayHomeAsUpEnabled(true);
        bar.setDisplayShowHomeEnabled(true);
    }

    FragmentTransaction fragmentTransaction = getSupportFragmentManager().beginTransaction();
    AccountListFragment.Type fragmentType;
    switch (type) {
    default:
    case BLOCKS: {
        fragmentType = AccountListFragment.Type.BLOCKS;
        break;
    }
    case MUTES: {
        fragmentType = AccountListFragment.Type.MUTES;
        break;
    }
    case FOLLOW_REQUESTS: {
        fragmentType = AccountListFragment.Type.FOLLOW_REQUESTS;
        break;
    }
    }
    Fragment fragment = AccountListFragment.newInstance(fragmentType);
    fragmentTransaction.add(R.id.fragment_container, fragment);
    fragmentTransaction.commit();
}