Example usage for android.os Bundle getInt

List of usage examples for android.os Bundle getInt

Introduction

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

Prototype

public int getInt(String key) 

Source Link

Document

Returns the value associated with the given key, or 0 if no mapping of the desired type exists for the given key.

Usage

From source file:com.aknowledge.v1.automation.RemoteActivity.java

@Override
public void onRestoreInstanceState(Bundle savedInstanceState) {
    // Restore the previously serialized current dropdown position.
    Log.d("RemoteActivity", "onRestoreInstanceState");
    if (savedInstanceState.containsKey(STATE_SELECTED_NAVIGATION_ITEM)) {
        getActionBar().setSelectedNavigationItem(savedInstanceState.getInt(STATE_SELECTED_NAVIGATION_ITEM));
    }/*from www .  j  a  v  a  2  s .co  m*/
}

From source file:es.uniovi.imovil.fcrtrainer.BaseExerciseFragment.java

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

    if (savedInstanceState == null) {
        return;/*from   www .  jav  a  2 s .  c  om*/
    }
    mIsPlaying = savedInstanceState.getBoolean(STATE_IS_PLAYING);

    if (mIsPlaying) {
        setGameInfoPanelVisibility(View.VISIBLE);
        mScore = savedInstanceState.getInt(STATE_SCORE);
        updateScore();
        showLevel();

        mDurationMs = savedInstanceState.getLong(STATE_DURATION_TIME_MS, DEFAULT_GAME_DURATION_MS);
        long consumedTime = savedInstanceState.getLong(STATE_CONSUMED_TIME_MS, mDurationMs);
        mStartMs = System.currentTimeMillis() - consumedTime;
        printRemainingTime();
        mTimerHandler.postDelayed(mUpdateTimeTask, CLOCK_UPDATE_PERIOD_MS);
    }
}

From source file:com.mercandalli.android.apps.files.file.cloud.FileCloudFragment.java

@Override
public void onCreate(final Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    final Bundle args = getArguments();
    if (!args.containsKey(ARG_POSITION_IN_VIEW_PAGER)) {
        throw new IllegalStateException("Missing args. Please use newInstance()");
    }//w w  w .j a v  a 2 s.c  o  m
    mFileManager = FileManager.getInstance(getContext());
    mFileCloudFabManager = FileCloudFabManager.getInstance();
    mPositionInViewPager = args.getInt(ARG_POSITION_IN_VIEW_PAGER);
    mFileCloudFabManager.addFabController(mPositionInViewPager, this);
}

From source file:mobisocial.musubi.ui.fragments.FeedViewFragment.java

@Override
public Loader<Cursor> onCreateLoader(int id, Bundle args) {
    final long feedId = Long.parseLong(mFeedUri.getLastPathSegment());
    loaderStartTime = new Date().getTime();

    //if max is too low things get very screwy
    int max = Math.max(25, args.getInt("max"));
    Loader<Cursor> cl = DbObjCursorAdapter.getLoaderForFeed(mActivity, feedId, max);
    //cl.setUpdateThrottle(2000);
    return cl;/*from   w  w  w.  j a  va2  s  .c om*/
}

From source file:fr.cph.chicago.core.activity.BusMapActivity.java

@Override
public final void onCreate(final Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    App.checkBusData(this);
    if (!this.isFinishing()) {
        MapsInitializer.initialize(getApplicationContext());
        setContentView(R.layout.activity_map);
        ButterKnife.bind(this);

        if (savedInstanceState != null) {
            busId = savedInstanceState.getInt(bundleBusId);
            busRouteId = savedInstanceState.getString(bundleBusRouteId);
            bounds = savedInstanceState.getStringArray(bundleBusBounds);
        } else {/*w w w  .j  ava  2  s  .c  o m*/
            final Bundle extras = getIntent().getExtras();
            busId = extras.getInt(bundleBusId);
            busRouteId = extras.getString(bundleBusRouteId);
            bounds = extras.getStringArray(bundleBusBounds);
        }

        busMarkers = new ArrayList<>();
        busStationMarkers = new ArrayList<>();
        views = new HashMap<>();
        status = new HashMap<>();
        busListener = new BusMapOnCameraChangeListener(getApplicationContext());

        setToolbar();

        Util.trackScreen(getApplicationContext(), analyticsBusMap);
    }
}

From source file:com.mohamnag.inappbilling.InAppBillingPlugin.java

private Error queryPurchases(String itemType) {
    Error ret = null;//  ww  w  .j a  va  2  s .  co  m
    jsLog("queryPurchases for type: " + itemType);

    try {
        Bundle ownedItems = iabService.getPurchases(3, cordova.getActivity().getPackageName(), itemType, null);

        int response = ownedItems.getInt("RESPONSE_CODE");
        if (response == BILLING_RESPONSE_RESULT_OK) {
            ArrayList<String> purchaseDataList = ownedItems.getStringArrayList("INAPP_PURCHASE_DATA_LIST");
            ArrayList<String> signatureList = ownedItems.getStringArrayList("INAPP_DATA_SIGNATURE_LIST");
            String continuationToken = ownedItems.getString("INAPP_CONTINUATION_TOKEN");

            jsLog("Got purchases: " + purchaseDataList.size());
            jsLog("Got signatures: " + signatureList.size());

            for (int i = 0; i < purchaseDataList.size(); ++i) {
                String purchaseData = purchaseDataList.get(i);
                String signature = signatureList.get(i);

                try {
                    Purchase purchase = new Purchase(purchaseData, signature);

                    if (base64EncodedPublicKey != null
                            && !Security.verifyPurchase(base64EncodedPublicKey, purchaseData, signature)) {

                        jsLog("Signature verification failed: " + purchaseData + " signature: " + signature);
                    } else {
                        jsLog("Purchase loaded for: " + purchase.getSku());

                        // add the purchase to the inventory
                        myInventory.addPurchase(purchase);
                    }
                } catch (JSONException e) {
                    ret = new Error(ERR_JSON_CONVERSION_FAILED, e.getMessage());
                }
            }
        }

        // TODO: if continuationToken != null, call getPurchases again 
        // and pass in the token to retrieve more items
    } catch (RemoteException ex) {
        Logger.getLogger(InAppBillingPlugin.class.getName()).log(Level.SEVERE, null, ex);
        ret = new Error(ERR_LOAD_RECEIPTS, ex.getMessage());
    }

    return ret;
}

From source file:com.jacr.instagramtrendreader.Main.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
    setContentView(R.layout.activity_main);

    /* Customizing ActionBar */
    Resources r = getResources();
    ActionBar ab = super.getActionBar(false);
    ab.setIcon(r.getDrawable(R.drawable.ic_menu_home));
    ab.setTitle(Util.getTitleActivity(getString(R.string.title_my_gallery_app)));

    /* Views *//*from   w ww .  j av a 2s  .c  o m*/
    layoutThumbnail = (TableLayout) findViewById(R.id.layoutThumbnail);
    layoutThumbnail.setPadding(1, 1, 1, 1);

    /* Setting Viewpager and Indicator */
    mPager = (ViewPager) findViewById(R.id.pagerMain);
    mAdapter = new ViewPagerAdapter<MainFragment>(getSupportFragmentManager());
    mPager.setOnPageChangeListener(new OnPageChangeListener() {

        @Override
        public void onPageScrollStateChanged(int arg0) {
        }

        @Override
        public void onPageScrolled(int arg0, float arg1, int arg2) {
        }

        @Override
        public void onPageSelected(int arg0) {
            int key = feedReader.getListThumbnailKeys().get(arg0);
            feedReader.highlightThumbnail(key);

        }

    });

    /* Receiver */
    mReceiver = new BroadcastReceiver() {

        @Override
        public void onReceive(Context context, Intent intent) {
            String action = intent.getAction();
            Bundle extras = intent.getExtras();
            if (action.contentEquals(ACTION_IMAGE_CLICK)) {
                int key = extras.getInt(ACTION_IMAGE_CLICK);
                if (key != -1) {
                    Intent in = new Intent(Main.this, ImageDetails.class);
                    Bundle b = new Bundle();

                    /*
                     * Warning with Error FAILED BINDED TRANSACTION: it
                     * happens When the transfer of "extras" out of memory.
                     * in This case, when images are sent in intent.
                     */
                    b.putSerializable(ImageDetails.KEY_THUMBNAIL_DATA, feedReader.getListThumbnailData());
                    b.putSerializable(ImageDetails.KEY_THUMBNAIL_KEYS, feedReader.getListThumbnailKeys());
                    b.putInt(ImageDetails.KEY_THUMBNAIL_ACTUAL_KEY, key);
                    in.putExtras(b);
                    startActivity(in);
                }

            }
        }
    };
    IntentFilter filter = new IntentFilter();
    filter.addAction(ACTION_IMAGE_CLICK);
    registerReceiver(mReceiver, filter);

    /* Load data from Instagram */
    cargarFeedReader();
}

From source file:gr.scify.newsum.ui.SearchViewActivity.java

private void initLayoutAndControls() {
    // Init topics
    initTopicSpinner();/*  w  w  w .  j  a v a  2 s .c o  m*/

    // Init zoom controls
    initZoomControls();

    // Init rating bar
    initRatingBar();

    // Init selected item
    Spinner spinner = (Spinner) findViewById(R.id.spinner1);
    // take the selected topic from the TopicActivity
    Bundle extras = getIntent().getExtras();
    // Show active topic
    final int num = extras.getInt("topicNum");
    spinner.setSelection(num);

}

From source file:com.openerp.addons.messages.MessageDetail.java

@Override
public void onStart() {
    super.onStart();
    Bundle bundle = getArguments();
    if (bundle != null) {
        if (bundle.containsKey("message_id")) {
            message_id = bundle.getInt("message_id");
            LoadMessageDetails messageDetails = new LoadMessageDetails(message_id);
            messageDetails.execute((Void) null);
        }//from   w ww .j  a v  a2 s .c  o  m
    }
}

From source file:com.mercandalli.android.apps.files.file.cloud.FileMyCloudFragment.java

@Override
public void onCreate(final Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    final Bundle args = getArguments();
    if (!args.containsKey(ARG_POSITION_IN_VIEW_PAGER)) {
        throw new IllegalStateException("Missing args. Please use newInstance()");
    }//w  w w. jav a  2s .  c o  m
    mPositionInViewPager = args.getInt(ARG_POSITION_IN_VIEW_PAGER);
    mFileCloudFabManager = FileCloudFabManager.getInstance();
    mFileCloudFabManager.addFabController(mPositionInViewPager, this);
    mFileManager = FileManager.getInstance(getContext());
}