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:com.juick.android.ThreadFragment.java

@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
    MainActivity.restyleChildrenOrWidget(view);
    Bundle args = getArguments();
    if (args != null) {
        mid = (MessageID) args.getSerializable("mid");
    }//from  w  ww .ja v  a  2  s  .c o  m
    if (mid == null) {
        return;
    }
    large = (ProgressBar) view.findViewById(R.id.progress_bar);
    small = (ProgressBar) view.findViewById(R.id.progress_bar_small);
    cached_copy_label = view.findViewById(R.id.cached_copy_label);

    getListView().setOnTouchListener(this);

    initAdapter();
    MessagesFragment.installDividerColor(getListView());

    if (parent != null)
        parent.imagePreviewHelper = listAdapter.imagePreviewHelper = new ImagePreviewHelper(
                (ViewGroup) getView().findViewById(R.id.imagepreview_container), getActivity());
}

From source file:com.owncloud.android.ui.activity.ReceiveExternalFilesActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    prepareStreamsToUpload();//from  w  w w. j a  va2 s  .com

    if (savedInstanceState == null) {
        mParents = new Stack<>();
        mAccountSelected = false;
        mAccountSelectionShowing = false;

    } else {
        mParents = (Stack<String>) savedInstanceState.getSerializable(KEY_PARENTS);
        mFile = savedInstanceState.getParcelable(KEY_FILE);
        mAccountSelected = savedInstanceState.getBoolean(KEY_ACCOUNT_SELECTED);
        mAccountSelectionShowing = savedInstanceState.getBoolean(KEY_ACCOUNT_SELECTION_SHOWING);
    }

    super.onCreate(savedInstanceState);

    if (mAccountSelected) {
        setAccount((Account) savedInstanceState.getParcelable(FileActivity.EXTRA_ACCOUNT));
    }

    // Listen for sync messages
    IntentFilter syncIntentFilter = new IntentFilter(
            RefreshFolderOperation.EVENT_SINGLE_FOLDER_CONTENTS_SYNCED);
    syncIntentFilter.addAction(RefreshFolderOperation.EVENT_SINGLE_FOLDER_SHARES_SYNCED);
    mSyncBroadcastReceiver = new SyncBroadcastReceiver();
    mLocalBroadcastManager = LocalBroadcastManager.getInstance(this);
    mLocalBroadcastManager.registerReceiver(mSyncBroadcastReceiver, syncIntentFilter);

    // Listen for upload messages
    IntentFilter uploadIntentFilter = new IntentFilter(FileUploader.getUploadFinishMessage());
    uploadIntentFilter.addAction(FileUploader.getUploadStartMessage());
    mUploadBroadcastReceiver = new UploadBroadcastReceiver();
    mLocalBroadcastManager.registerReceiver(mUploadBroadcastReceiver, uploadIntentFilter);

    // Init Fragment without UI to retain AsyncTask across configuration changes
    FragmentManager fm = getSupportFragmentManager();
    TaskRetainerFragment taskRetainerFragment = (TaskRetainerFragment) fm
            .findFragmentByTag(TaskRetainerFragment.FTAG_TASK_RETAINER_FRAGMENT);
    if (taskRetainerFragment == null) {
        taskRetainerFragment = new TaskRetainerFragment();
        fm.beginTransaction().add(taskRetainerFragment, TaskRetainerFragment.FTAG_TASK_RETAINER_FRAGMENT)
                .commit();
    } // else, Fragment already created and retained across configuration change
}

From source file:de.j4velin.mapsmeasure.Map.java

@Override
protected void onRestoreInstanceState(final Bundle savedInstanceState) {
    super.onRestoreInstanceState(savedInstanceState);
    try {//from  w  w  w .  ja  v a 2  s  . c om
        metric = savedInstanceState.getBoolean("metric");
        @SuppressWarnings("unchecked")
        // Casting to Stack<LatLng> apparently results in
        // "java.lang.ClassCastException: java.util.ArrayList cannot be cast to java.util.Stack"
        // on some devices
        List<LatLng> tmp = (List<LatLng>) savedInstanceState.getSerializable("trace");
        Iterator<LatLng> it = tmp.iterator();
        while (it.hasNext()) {
            addPoint(it.next());
        }
        mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(
                new LatLng(savedInstanceState.getDouble("position-lat"),
                        savedInstanceState.getDouble("position-lon")),
                savedInstanceState.getFloat("position-zoom")));
    } catch (Exception e) {
        e.printStackTrace();
    }
}

From source file:com.makotojava.android.debate.PolicySpeechFragment.java

private void restoreInstanceState(Bundle savedInstanceState) {
    Log.d(TAG, "Restoring instance state for Speech => " + _speech);
    if (savedInstanceState != null) {
        _speechTimer = (SpeechCountDownTimerWithAlarm) savedInstanceState.getSerializable(SPEECH_TIMER);
        _crossexTimer = (SpeechCountDownTimerWithAlarm) savedInstanceState.getSerializable(CROSSEX_TIMER);
        _affirmativePrepTimer = (SpeechCountDownTimerWithAlarm) savedInstanceState
                .getSerializable(AFFPREP_TIMER);
        _affirmativePrepTimer/*from w w w. j  a v a2 s .  c o  m*/
                .setMillisUntilFinished(getPolicySpeechSingleton().getAffirmativePrepRemainingTime());
        _negativePrepTimer = (SpeechCountDownTimerWithAlarm) savedInstanceState.getSerializable(NEGPREP_TIMER);
        _negativePrepTimer.setMillisUntilFinished(getPolicySpeechSingleton().getNegativePrepRemainingTime());
        getSystemOptions();// re-initialize
        adjustAppBasedOnSpecifiedState(STATE.INSTANCE_STATE_RESTORED);
        manageState();
    } else {
        Log.i(TAG, "SAVED INSTANCE STATE IS NULL!!");
    }
}

From source file:com.android.calendar.event.EditEventFragment.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    if (savedInstanceState != null) {
        if (savedInstanceState.containsKey(BUNDLE_KEY_MODEL)) {
            mRestoreModel = (CalendarEventModel) savedInstanceState.getSerializable(BUNDLE_KEY_MODEL);
        }//  ww w  . ja v a 2  s  .c  o  m
        if (savedInstanceState.containsKey(BUNDLE_KEY_EDIT_STATE)) {
            mModification = savedInstanceState.getInt(BUNDLE_KEY_EDIT_STATE);
        }
        if (savedInstanceState.containsKey(BUNDLE_KEY_EDIT_ON_LAUNCH)) {
            mShowModifyDialogOnLaunch = savedInstanceState.getBoolean(BUNDLE_KEY_EDIT_ON_LAUNCH);
        }
        if (savedInstanceState.containsKey(BUNDLE_KEY_EVENT)) {
            mEventBundle = (EventBundle) savedInstanceState.getSerializable(BUNDLE_KEY_EVENT);
        }
        if (savedInstanceState.containsKey(BUNDLE_KEY_READ_ONLY)) {
            mIsReadOnly = savedInstanceState.getBoolean(BUNDLE_KEY_READ_ONLY);
        }
        if (savedInstanceState.containsKey("EditEventView_timebuttonclicked")) {
            mTimeSelectedWasStartTime = savedInstanceState.getBoolean("EditEventView_timebuttonclicked");
        }
        if (savedInstanceState.containsKey(BUNDLE_KEY_DATE_BUTTON_CLICKED)) {
            mDateSelectedWasStartDate = savedInstanceState.getBoolean(BUNDLE_KEY_DATE_BUTTON_CLICKED);
        }
        if (savedInstanceState.containsKey(BUNDLE_KEY_SHOW_COLOR_PALETTE)) {
            mShowColorPalette = savedInstanceState.getBoolean(BUNDLE_KEY_SHOW_COLOR_PALETTE);
        }

    }
}

From source file:com.sbgapps.scoreit.ScoreItActivity.java

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

    mAppBarLayout = (AppBarLayout) findViewById(R.id.appbar);
    mSlidingLayer = (SlidingLayer) findViewById(R.id.sliding_layer);

    mGameManager = new GameManager(this);
    mGameManager.loadGame();/*  w  w w.  j a  v  a2 s .co  m*/

    if (null != savedInstanceState) {
        mLap = (Lap) savedInstanceState.getSerializable("lap");
        mIsEdited = savedInstanceState.getBoolean("edited");
        if (mIsEdited) {
            int position = savedInstanceState.getInt("position");
            mEditedLap = mGameManager.getLaps().get(position);
        }

        mHeaderFragment = (HeaderFragment) getSupportFragmentManager().findFragmentByTag(HeaderFragment.TAG);
        mScoreListFragment = (ScoreListFragment) getSupportFragmentManager()
                .findFragmentByTag(ScoreListFragment.TAG);
        mScoreChartFragment = (ScoreChartFragment) getSupportFragmentManager()
                .findFragmentByTag(ScoreChartFragment.TAG);
    } else {
        reloadUi(false);
    }

    setupActionBar();
    setupDrawer();
    setupActionButton();
    setupChartPane();
}

From source file:de.schildbach.litecoinwallet.ui.SendCoinsFragment.java

private void initStateFromIntentExtras(@Nonnull final Bundle extras) {
    final String address = extras.getString(SendCoinsActivity.INTENT_EXTRA_ADDRESS);
    final String addressLabel = extras.getString(SendCoinsActivity.INTENT_EXTRA_ADDRESS_LABEL);
    final BigInteger amount = (BigInteger) extras.getSerializable(SendCoinsActivity.INTENT_EXTRA_AMOUNT);
    final String bluetoothMac = extras.getString(SendCoinsActivity.INTENT_EXTRA_BLUETOOTH_MAC);

    update(address, addressLabel, amount, bluetoothMac);
}

From source file:com.inter.trade.ui.fragment.buylicensekey.BuyLicenseKeyPayConfirmFragment.java

@Override
public void onCreate(Bundle savedInstanceState) {
    // TODO Auto-generated method stub
    super.onCreate(savedInstanceState);

    Bundle data = getArguments();
    if (data != null) {
        mHotelOrderData = (HotelOrderData) data.getSerializable("hotelOrder");
    }//from   www . jav  a2s. c  o  m

    PayApp.mSwipListener = this;

}

From source file:azad.hallaji.farzad.com.masirezendegi.ExplainMoshaver.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_explain_moshaver);
    Fabric.with(this, new Crashlytics());

    alagestarmoshaver = (ImageView) findViewById(R.id.alagestarmoshaver);

    if (savedInstanceState == null) {
        Bundle extras = getIntent().getExtras();
        if (extras == null) {
            placeid = "";
        } else {//w  ww.  j  a v a  2 s .com
            placeid = extras.getString("placeid");
        }
    } else {
        placeid = (String) savedInstanceState.getSerializable("placeid");
    }

    ImageView imageView1 = (ImageView) findViewById(R.id.backButton);
    imageView1.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            Intent intent = new Intent(ExplainMoshaver.this, PageMoshaverin.class);
            intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
            intent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
            startActivity(intent);
        }
    });

    final DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
    NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view);
    navigationView.setNavigationItemSelectedListener(this);
    ImageView imageView = (ImageView) findViewById(R.id.menuButton);
    imageView.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            drawer.openDrawer(Gravity.END);
        }
    });

    if (GlobalVar.getUserType().equals("adviser") || GlobalVar.getUserType().equals("user")) {
        Menu nav_Menu = navigationView.getMenu();
        nav_Menu.findItem(R.id.nav_marakez).setVisible(true);
        nav_Menu.findItem(R.id.nav_profile).setVisible(true);
        nav_Menu.findItem(R.id.nav_login).setVisible(false);
        nav_Menu.findItem(R.id.nav_moshaverin).setVisible(true);
        nav_Menu.findItem(R.id.nav_porseshha).setVisible(true);
        nav_Menu.findItem(R.id.nav_logout).setVisible(true);
    } else {
        Menu nav_Menu = navigationView.getMenu();
        nav_Menu.findItem(R.id.nav_marakez).setVisible(true);
        nav_Menu.findItem(R.id.nav_profile).setVisible(false);
        nav_Menu.findItem(R.id.nav_login).setVisible(true);
        nav_Menu.findItem(R.id.nav_moshaverin).setVisible(true);
        nav_Menu.findItem(R.id.nav_porseshha).setVisible(true);
        nav_Menu.findItem(R.id.nav_logout).setVisible(false);
    }

    userimg = (ImageView) findViewById(R.id.adviser_image);
    name_moshaver_textview = (TextView) findViewById(R.id.name_moshaver_textview);
    //taxassose_moshaver_textview =(TextView) findViewById(R.id.taxassose_moshaver_textview);
    code_moshaver_textview = (TextView) findViewById(R.id.code_moshaver_textview);

    if (savedInstanceState == null) {
        Bundle extras = getIntent().getExtras();
        if (extras == null) {
            adviseridm = "0";
        } else {
            adviseridm = extras.getString("adviserid");
        }
    } else {
        adviseridm = (String) savedInstanceState.getSerializable("adviserid");
    }

    //Toast.makeText(getApplicationContext(), "+"+adviseridm+"+", Toast.LENGTH_LONG).show();

    if (isOnline()) {
        //requestData();

        postgetData();
        //Log.i("Lieseesene",License);

        ImageView imageView2 = (ImageView) findViewById(R.id.adviser_about_img);
        imageView2.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                //requestDataa();

                if (GlobalVar.getUserType().equals("adviser") || GlobalVar.getUserType().equals("user")) {

                    Intent intent3 = new Intent(ExplainMoshaver.this, PageRezerv.class);
                    intent3.putExtra("adviseridm", adviseridm);
                    intent3.putExtra("placeid", placeid);
                    intent3.putExtra("namemoshaver", namemoshaver);

                    startActivity(intent3);

                } else {
                    Toast.makeText(getApplicationContext(), "    ",
                            Toast.LENGTH_LONG).show();
                }

            }
        });

        //
        // final ImageView alagestarmarkaz = (ImageView)findViewById(R.id.alagestarmarkaz);

        alagestarmoshaver.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                //Log.i("sxascsdcpsdcpsdcpsdc","[sxascsdcpsdcpsdcpsdc"+alagestarmarkaz.getResources());

                if (GlobalVar.getUserType().equals("adviser") || GlobalVar.getUserType().equals("user")) {

                    setAlage();
                    //Log.i("sxascsdcpsdcpsdcpsdc","[sxascsdcp2sdcpsdcpsdc"+hanyayo);

                } else {
                    Toast.makeText(getApplicationContext(), "    ",
                            Toast.LENGTH_LONG).show();
                }
            }
        });

        ImageView adviser_reserve_img = (ImageView) findViewById(R.id.adviser_reserve_img);
        adviser_reserve_img.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                final LinearLayout darbareyehuseyin = (LinearLayout) findViewById(R.id.darbareyehuseyin);
                darbareyehuseyin.setVisibility(View.VISIBLE);
                TextView textTagsHusseyin = (TextView) findViewById(R.id.textTagsHusseyin);
                try {
                    textTagsHusseyin.setText(Tagggggggs);
                    ImageView closeafzundanejavab = (ImageView) findViewById(R.id.closeinvisibleimag);
                    closeafzundanejavab.setOnClickListener(new View.OnClickListener() {
                        @Override
                        public void onClick(View v) {
                            darbareyehuseyin.setVisibility(View.GONE);
                        }
                    });

                } catch (Exception e) {
                    textTagsHusseyin.setText("");
                }

            }
        });

    } else {
        Toast.makeText(getApplicationContext(), "Network isn't available", Toast.LENGTH_LONG).show();
    }
}

From source file:com.brq.wallet.activity.receive.ReceiveCoinsActivity.java

/**
 * Called when the activity is first created.
 *///from   ww w.j  a  v  a2 s. com
@Override
public void onCreate(Bundle savedInstanceState) {
    this.requestWindowFeature(Window.FEATURE_NO_TITLE);
    this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
            WindowManager.LayoutParams.FLAG_FULLSCREEN);
    super.onCreate(savedInstanceState);
    setContentView(R.layout.receive_coins_activity);
    ButterKnife.bind(this);

    _mbwManager = MbwManager.getInstance(getApplication());

    // Get intent parameters
    _address = Preconditions.checkNotNull((Address) getIntent().getSerializableExtra("address"));
    _havePrivateKey = getIntent().getBooleanExtra("havePrivateKey", false);
    _showIncomingUtxo = getIntent().getBooleanExtra("showIncomingUtxo", false);

    // Load saved state
    if (savedInstanceState != null) {
        _amount = (CurrencyValue) savedInstanceState.getSerializable(AMOUNT);
        _receivingSince = savedInstanceState.getLong(RECEIVING_SINCE);
        _lastAddressBalance = (CurrencyValue) savedInstanceState.getSerializable(LAST_ADDRESS_BALANCE);
        _syncErrors = savedInstanceState.getInt(SYNC_ERRORS);
    } else {
        _receivingSince = new Date().getTime();
    }

    // Amount Hint
    tvAmount.setHint(getResources().getString(R.string.amount_hint_denomination,
            _mbwManager.getBitcoinDenomination().toString()));
    shareByNfc();
}