Example usage for android.os Bundle getSerializable

List of usage examples for android.os Bundle getSerializable

Introduction

In this page you can find the example usage for android.os Bundle getSerializable.

Prototype

@Override
@Nullable
public Serializable getSerializable(@Nullable String key) 

Source Link

Document

Returns the value associated with the given key, or null if no mapping of the desired type exists for the given key or a null value is explicitly associated with the key.

Usage

From source file:ca.hoogit.soundchooser.SoundChooserDialog.java

@Override
@SuppressWarnings("ConstantConditions")
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    if (getArguments() != null) {
        mTitle = getArguments().getString(KEY_TITLE);
        mCircleColor = getArguments().getInt(KEY_CIRCLE_COLOR);
        mColumns = getArguments().getInt(KEY_COLUMNS);
        mSize = getArguments().getInt(KEY_SIZE);
    }// ww  w .  j a  v a2s  .c  om

    if (savedInstanceState != null) {
        mSounds = savedInstanceState.getIntArray(KEY_SOUNDS);
        mSelectedSound = (Integer) savedInstanceState.getSerializable(KEY_SELECTED_SOUND);
    }
}

From source file:de.zell.android.util.fragments.EntityListFragment.java

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

    if (savedInstanceState == null) {
        savedInstanceState = getArguments();
    }//from w w w.j av a 2s.c om

    if (savedInstanceState != null) {
        restoreEntities(savedInstanceState, TAG_ENTITIES_CONTENT);
        EntityListAdapter adapter = getEntityListAdapter(getActivity());
        if (entities == null) {
            restoreEntities(savedInstanceState, ARG_ENTITIES);
            if (entities == null) {
                url = (String) savedInstanceState.getSerializable(ARG_ENTITIES_URL);
                loadEntities();
            }
        }
        barManager = new ActionBarTitleManager(savedInstanceState);
        if (entities != null)
            adapter.setEntities(entities);
        setListAdapter(adapter);
    }
}

From source file:com.ibuildapp.romanblack.MultiContactsPlugin.MultiContactsPlugin.java

@Override
public void create() {
    try {//  w  w w . j a v a2s. com
        Intent currentIntent = getIntent();
        Bundle store = currentIntent.getExtras();
        widget = (Widget) store.getSerializable("Widget");

        if (widget == null) {
            handler.sendEmptyMessage(INITIALIZATION_FAILED);
            return;
        }

        if (widget.getPluginXmlData().length() == 0) {
            if (widget.getPathToXmlFile().length() == 0) {
                handler.sendEmptyMessageDelayed(INITIALIZATION_FAILED, 100);
                return;
            }
        }

        new Thread() {
            @Override
            public void run() {
                try {//ErrorLogging
                    if (widget.getPluginXmlData() != null && widget.getPluginXmlData().length() > 0) {
                        parser = new EntityParser(widget.getPluginXmlData());
                    } else {
                        String xmlData = readXmlFromFile(widget.getPathToXmlFile());
                        parser = new EntityParser(xmlData);
                    }
                    persons = parser.parse();

                    Statics.color1 = parser.getColor1();
                    Statics.color2 = parser.getColor2();
                    Statics.color3 = parser.getColor3();
                    Statics.color4 = parser.getColor4();
                    Statics.color5 = parser.getColor5();
                    Statics.isLight = parser.isLight();

                    PluginData.getInstance().setPersons(parser.getPersons());
                    PluginData.getInstance().prepareCounts();
                    // set background color/image/httpimage

                    handler.sendEmptyMessage(SET_ROOT_BACKGROUND);
                } catch (Exception e) {
                    Log.e(TAG, e.getMessage());
                    e.printStackTrace();
                }
            }
        }.start();
    } catch (Exception e) {
        Log.e(TAG, e.getMessage());
        e.printStackTrace();
    }
}

From source file:com.ofalvai.bpinfo.ui.alertlist.AlertListFragment.java

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

    Set<RouteType> restoredFilter = null;

    if (savedInstanceState != null) {
        mAlertListType = (AlertListType) savedInstanceState.getSerializable(KEY_ALERT_LIST_TYPE);
        restoredFilter = (HashSet<RouteType>) savedInstanceState.getSerializable(KEY_ACTIVE_FILTER);
    }//from   ww  w.  ja v a2 s. c  om

    mPresenter = new AlertListPresenter(mAlertListType);
    mPresenter.attachView(this);

    if (restoredFilter != null) {
        mPresenter.setFilter(restoredFilter);
    }
}

From source file:com.waz.zclient.pages.main.participants.ParticipantBodyFragment.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    Bundle args = getArguments();
    userRequester = (IConnectStore.UserRequester) args.getSerializable(ARG_USER_REQUESTER);
}

From source file:cmput301.f13t01.readstory.ReadFragmentActivity.java

/**
 * Called when the activity is first created. Receives intent from main
 * activity to create the first fragment.
 *//*w w  w.j av  a2s  .co m*/
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    app = (GlobalManager) getApplication();
    save = GlobalManager.getLocalManager();

    setContentView(R.layout.activity_view_fragment);

    // if it is not starting from beginning, start reading according to
    // history
    if (savedInstanceState != null) {
        storyId = (UUID) savedInstanceState.getSerializable(getResources().getString(R.string.story_id));
        app.setStoryManager(storyId);
        this.storyManager = app.getStoryManager();
        fragmentId = storyManager.getMostRecent();

    } else {

        // intent has the story ID, and story fragment ID to display
        Intent intent = getIntent();
        // receive id of story fragment to show
        storyId = (UUID) intent.getSerializableExtra(getResources().getString(R.string.story_id));

        // set the story in the story manager
        app.setStoryManager(storyId);
        this.storyManager = app.getStoryManager();

        // depending if we are reading from beginning,
        // fetch the appropriate fragment ID accordingly
        Boolean fromBeginning = (boolean) intent
                .getBooleanExtra(getResources().getString(R.string.story_continue), false);
        if (fromBeginning) {
            storyManager.clearHistory();
            fragmentId = storyManager.getFirstPageId();
        } else {
            // show first page if the story has never been read
            fragmentId = storyManager.getMostRecent();
            if (fragmentId == null) {
                fragmentId = storyManager.getFirstPageId();
            }
        }

        // if there is no first page set, exit readmode
        if (fragmentId == null) {
            Toast.makeText(getBaseContext(), "First page has not been set for this story!", Toast.LENGTH_LONG)
                    .show();
            finish();
        }

    }

    commitFragment(fragmentId);
}

From source file:com.meetingninja.csse.agenda.ReviewAgendaActivity.java

@SuppressWarnings("unchecked")
@Override//ww w.j  ava2  s. c om
public void onCreate(final Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    boolean newCollapsible;
    setContentView(R.layout.activity_agenda_review);

    setupActionBar();

    if (savedInstanceState == null) {
        manager = new InMemoryTreeStateManager<Topic>();
        newCollapsible = false;
        displayedAgenda = ((AgendaParcel) getIntent().getParcelableExtra(Keys.Agenda.PARCEL)).getAgenda();
    } else {
        manager = (TreeStateManager<Topic>) savedInstanceState.getSerializable("treeManager");
        newCollapsible = savedInstanceState.getBoolean("collapsible");
        displayedAgenda = ((AgendaParcel) savedInstanceState.getParcelable(Keys.Agenda.PARCEL)).getAgenda();
    }

    setupViews();
    treeBuilder = new TreeBuilder<Topic>(manager);

    if (displayedAgenda != null) {
        int depth = displayedAgenda.getDepth();
        mAgendaAdpt = new ReviewAgendaItemAdapter(this, manager, treeBuilder, depth);
        mAgendaAdpt.addActivity(this);
        buildTree(treeBuilder);
    }
    treeView.setAdapter(mAgendaAdpt);

    setCollapsible(newCollapsible);

    // registerForContextMenu(treeView);
}

From source file:com.gh4a.activities.IssueEditActivity.java

@Override
protected void onInitExtras(Bundle extras) {
    super.onInitExtras(extras);
    mRepoOwner = extras.getString(Constants.Repository.OWNER);
    mRepoName = extras.getString(Constants.Repository.NAME);
    mEditIssue = (Issue) extras.getSerializable(EXTRA_ISSUE);
}

From source file:com.auth0.lock.fragment.SignUpFormFragment.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    final Bundle arguments = getArguments();
    final Lock lock = Lock.getLock(getActivity());
    client = lock.getAuthenticationAPIClient();
    bus = lock.getBus();/* w  ww . jav a  2 s  .  co  m*/
    errorBuilder = new SignUpAuthenticationErrorBuilder();
    useEmail = arguments == null || arguments.getBoolean(USE_EMAIL_SIGNUP_ARGUMENT);
    loginAfterSignUp = arguments == null || arguments.getBoolean(LOGIN_AFTER_SIGNUP_ARGUMENT);
    authenticationParameters = arguments != null
            ? (Map<String, Object>) arguments.getSerializable(AUTHENTICATION_PARAMETER_ARGUMENT)
            : null;
    final Connection connection = lock.getConfiguration().getDefaultDatabaseConnection();
    if (connection != null) {
        authenticationParameters = ParameterBuilder.newBuilder().setConnection(connection.getName())
                .addAll(authenticationParameters).asDictionary();
        Log.d(TAG, "Specified DB connection with name " + connection.getName());
        requiresUsername = connection.booleanForKey("requires_username");
    }
    validator = new SignUpValidator(useEmail, requiresUsername);
}

From source file:com.eTilbudsavis.sdkdemo.Search.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.search);/*from   w  w w.  j a  v  a2s .c om*/

    Eta.createInstance(Keys.API_KEY, Keys.API_SECRET, this);

    // Find views
    mQuery = (EditText) findViewById(R.id.etQuery);
    mListView = (ListView) findViewById(R.id.lvResult);

    // Check for any saved state
    if (savedInstanceState != null && savedInstanceState.containsKey(ARG_OFFERS)
            && savedInstanceState.containsKey(ARG_QUERY)) {
        mOffers = (List<Offer>) savedInstanceState.getSerializable(ARG_OFFERS);
        if (mOffers != null) {
            mListView.setAdapter(new SearchAdapter());
        }
        String q = savedInstanceState.getString(ARG_QUERY);
        if (q != null) {
            mQuery.setText(q);
            mQuery.setSelection(q.length());
        }

    }

    System.out.print("Eta null: " + Eta.getInstance().getClass().toString());

    Button search = (Button) findViewById(R.id.btnPerformSearch);
    search.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {

            String query = mQuery.getText().toString().trim();

            if (query.length() > 0) {

                mPd = ProgressDialog.show(Search.this, "", "Searching...", true, true);
                performSearch(query);

            }

        }
    });

}