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:gr.scify.newsum.ui.ViewActivity.java

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

    iPrvSelectedItem = savedInstanceState.getInt(SELECTED_ITEM_BUNDLE_KEY);
}

From source file:com.transistorsoft.cordova.bggeo.CDVBackgroundGeolocation.java

private void onLocationError(Bundle event) {
    Integer code = event.getInt("code");
    if (code == BackgroundGeolocationService.LOCATION_ERROR_DENIED) {
        if (isDebugging()) {
            Toast.makeText(this.cordova.getActivity(), "Location services disabled!", Toast.LENGTH_SHORT)
                    .show();//ww w . j  av a2  s  .  c o m
        }
    }
    PluginResult result = new PluginResult(PluginResult.Status.ERROR, code);
    result.setKeepCallback(true);
    for (CallbackContext callback : locationCallbacks) {
        callback.sendPluginResult(result);
    }

    if (isAcquiringCurrentPosition) {
        finishAcquiringCurrentPosition(false);
        for (CallbackContext callback : currentPositionCallbacks) {
            callback.error(code);
        }
        currentPositionCallbacks.clear();
    }
}

From source file:com.dvn.vindecoder.ui.user.GetAllVehicalDetails.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    //  setContentView(R.layout.activity_get_all_vehical_details);
    // Watch for button clicks.
    /* Button button = (Button)findViewById(R.id.new_fragment);
            //w  w  w.  j a  v a  2  s.c  om
     button.setOnClickListener(new OnClickListener() {
    public void onClick(View v) {
        addFragmentToStack();
    }
     });*/
    setTitle("Vehical details");
    Bundle bundle = getIntent().getExtras();
    if (bundle != null) {
        CommonURL.V_ID = bundle.getString("v_id");
        v_id = bundle.getString("v_id");
        CommonURL.PK_ID = v_id;
        if (bundle.containsKey("user_type")) {
            CommonURL.USER_TYPE = bundle.getInt("user_type");
            ;
        }
    }
    drawChildLayout();
    if (savedInstanceState == null) {
        // Do first time initialization -- add initial fragment.
        /*  newFragment = GetNewVehicalFragment.newInstance(GetAllVehicalDetails.this);
         FragmentTransaction ft = getFragmentManager().beginTransaction();
         ft.add(R.id.fragment1, newFragment).commit();*/

        addVehicalFragment_new_for_user = AddVehicalFragment_New_For_User
                .newInstance(GetAllVehicalDetails.this);
        FragmentTransaction ft = getFragmentManager().beginTransaction();
        ft.add(R.id.fragment1, addVehicalFragment_new_for_user).commit();
    } else {
        mStackLevel = savedInstanceState.getInt("level");
    }

    fab = (FloatingActionButton) findViewById(R.id.fab);
    TextView fab_txt = (TextView) findViewById(R.id.textView12);
    if (CommonURL.USER_TYPE == 1) {

        fab.setVisibility(View.GONE);
        fab_txt.setVisibility(View.GONE);
    }
    fab.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            //handleCameraForPickingPhoto();
            openDialog();
        }
    });

}

From source file:jp.app_mart.billing.AppmartHelper.java

/**
 * ??/*from w  ww.  j av  a 2s. c o  m*/
 * @param act
 * @param sku
 * @param requestCode
 * @param listener
 */
public void launchPurchaseFlow(final Activity act, final String sku, final int requestCode,
        final OnAppmartPurchaseFinishedListener listener) {

    final String itemType = "0";

    checkSetupDone("launchPurchaseFlow");

    (new Thread(new Runnable() {
        public void run() {

            logDebug(mContext.getString(R.string.get_information) + sku);
            AppmartResult result;

            try {
                Context context = mContext.getApplicationContext();
                String dataEncrypted = createEncryptedData(sku, mDeveloperId, mLicenseKey, mSignatureBase64);
                Bundle bundleForPaymentInterface = mService.prepareForBillingService(mAppId, dataEncrypted);

                if (bundleForPaymentInterface == null) {

                    logError(mContext.getString(R.string.bundle_unreachable));

                    result = new AppmartResult(APPMARTHELPER_GET_BUNDLE_FOR_PAYMENT_FAILED,
                            mContext.getString(R.string.bundle_unreachable));

                    if (listener != null)
                        listener.onAppmartPurchaseFinished(result, null);
                    return;
                }

                int response = bundleForPaymentInterface.getInt("resultCode");

                if (response != BILLING_RESPONSE_RESULT_OK) {

                    logError(mContext.getString(R.string.response_code_error) + response);
                    result = new AppmartResult(response, mContext.getString(R.string.product_not_purchasable));

                    if (listener != null)
                        listener.onAppmartPurchaseFinished(result, null);
                    return;
                }

                // ?
                resultKey = bundleForPaymentInterface.getString("resultKey");

                PendingIntent pIntent = bundleForPaymentInterface.getParcelable("appmart_pending_intent");
                mPurchaseListener = listener;
                mPurchasingItemType = itemType;
                mPurchasingSku = sku;
                pIntent.send(context, 0, new Intent());

            } catch (RemoteException e) {

                logError(mContext.getString(R.string.failed_prepare_bill_service));

                result = new AppmartResult(APPMARTHELPER_SEND_INTENT_FAILED,
                        mContext.getString(R.string.failed_sending_intent));

                if (listener != null)
                    listener.onAppmartPurchaseFinished(result, null);

            } catch (PendingIntent.CanceledException e) {

                logError(mContext.getString(R.string.failed_sending_intent));

                result = new AppmartResult(APPMARTHELPER_SEND_INTENT_FAILED,
                        mContext.getString(R.string.failed_sending_intent));

                if (listener != null)
                    listener.onAppmartPurchaseFinished(result, null);
            }
        }
    })).start();
}

From source file:com.xargsgrep.portknocker.activity.EditHostActivity.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.host_edit);/*from   w  ww  .j av a  2s  .c  o m*/

    databaseManager = new DatabaseManager(this);

    Bundle extras = getIntent().getExtras();
    hostId = (BundleUtils.contains(extras, KEY_HOST_ID)) ? extras.getLong(KEY_HOST_ID) : null;
    Host host = (hostId == null) ? null : databaseManager.getHost(hostId);

    if (host != null)
        getSupportActionBar().setSubtitle(host.getLabel());
    getSupportActionBar().setHomeButtonEnabled(true);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    getSupportActionBar().setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);

    addTab(getString(R.string.host_tab_name));
    addTab(getString(R.string.ports_tab_name));
    addTab(getString(R.string.misc_tab_name));

    if (savedInstanceState != null) {
        getSupportActionBar().setSelectedNavigationItem(savedInstanceState.getInt(KEY_SELECTED_TAB_INDEX));
        if (savedInstanceState.getBoolean(KEY_SHOW_CANCEL_DIALOG))
            showCancelDialog();
    }
}

From source file:com.onesignal.NotificationExtenderService.java

private void processIntent(Intent intent) {
    Bundle bundle = intent.getExtras();

    // Service maybe triggered without extras on some Android devices on boot.
    // https://github.com/OneSignal/OneSignal-Android-SDK/issues/99
    if (bundle == null) {
        OneSignal.Log(OneSignal.LOG_LEVEL.ERROR,
                "No extras sent to NotificationExtenderService in its Intent!\n" + intent);
        return;/*from   w  w  w . j av a2s .c om*/
    }

    String jsonStrPayload = bundle.getString("json_payload");
    if (jsonStrPayload == null) {
        OneSignal.Log(OneSignal.LOG_LEVEL.ERROR,
                "json_payload key is nonexistent from bundle passed to NotificationExtenderService: " + bundle);
        return;
    }

    try {
        currentJsonPayload = new JSONObject(jsonStrPayload);
        currentlyRestoring = bundle.getBoolean("restoring", false);
        if (bundle.containsKey("android_notif_id")) {
            currentBaseOverrideSettings = new OverrideSettings();
            currentBaseOverrideSettings.androidNotificationId = bundle.getInt("android_notif_id");
        }

        if (!currentlyRestoring && OneSignal.notValidOrDuplicated(this, currentJsonPayload))
            return;

        restoreTimestamp = bundle.getLong("timestamp");
        processJsonObject(currentJsonPayload, currentlyRestoring);
    } catch (JSONException e) {
        e.printStackTrace();
    }
}

From source file:com.example.alvarpao.popularmovies.MovieDetailFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

    View rootView = inflater.inflate(R.layout.movie_detail_fragment, container, false);

    // Get the fragmnent's arguments in case the fragment has been created when in
    // two-pane mode. If that is the case, retrieve the selected movie's info from the
    // arguments not the intent.
    Bundle arguments = getArguments();/*from  w w w .j a  v  a 2  s . co  m*/

    // If in one-pane mode get intent instead to get the passed movie info
    if (arguments == null)
        arguments = getActivity().getIntent().getExtras();

    // Restore state of DetailsFragment if there was a rotation
    if (savedInstanceState != null) {

        if (savedInstanceState.containsKey(MOVIE))
            mMovie = savedInstanceState.getParcelable(MOVIE);

        if (savedInstanceState.containsKey(SCROLL_POSITION))
            mScrollPosition = savedInstanceState.getInt(SCROLL_POSITION);
    }

    else {
        if (arguments != null)
            mMovie = arguments.getParcelable(MOVIE_DETAILS);
    }

    // Initialize Movie Details' recycler view
    mMovieDetailsRecyclerView = (RecyclerView) rootView.findViewById(R.id.movieDetailsRecyclerViewer);
    mMovieDetailsRecyclerView.setLayoutManager(new LinearLayoutManager(mMovieDetailsRecyclerView.getContext()));
    mMovieDetailsRecyclerView.setItemAnimator(null);

    if ((arguments != null) && (mMovie != null)) {
        // Initially the trailers and reviews arrays are empty, it is not after the
        // getExtraMovieInfo() is called that the adapter is populated.

        mMovieDetailsAdapter = new MovieDetailsRecyclerAdapter(getActivity(), mMovie, mMovie.trailers,
                mMovie.reviews);
        // Make sure the trailers and reviews for the adapter are reset
        mMovieDetailsRecyclerView.setAdapter(mMovieDetailsAdapter);

        // Restore scroll position for Recycler View
        if (savedInstanceState != null)
            mMovieDetailsRecyclerView.getLayoutManager().scrollToPosition(mScrollPosition);

        //No needed to retrieve trailers and reviews if there was a rotation
        if (savedInstanceState == null) {
            mMovieDetailsAdapter.clearTrailersAndReviews();
            mMovieDetailsAdapter.notifyDataSetChanged();
            getExtraMovieInfo();
        }
    }

    return rootView;
}

From source file:com.buddi.client.dfu.DfuActivity.java

@Override
protected void onCreate(final Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_feature_dfu);
    isBLESupported();//  w ww.j ava  2 s. co m
    if (!isBLEEnabled()) {
        showBLEDialog();
    }
    setGUI();

    ensureSamplesExist();

    // restore saved state
    mFileType = DfuService.TYPE_APPLICATION; // Default
    if (savedInstanceState != null) {
        mFileType = savedInstanceState.getInt(DATA_FILE_TYPE);
        mFileTypeTmp = savedInstanceState.getInt(DATA_FILE_TYPE_TMP);
        mFilePath = savedInstanceState.getString(DATA_FILE_PATH);
        mFileStreamUri = savedInstanceState.getParcelable(DATA_FILE_STREAM);
        mSelectedDevice = savedInstanceState.getParcelable(DATA_DEVICE);
        mStatusOk = mStatusOk || savedInstanceState.getBoolean(DATA_STATUS);
        mUploadButton.setEnabled(mSelectedDevice != null && mStatusOk);
    }
    //mSelectedDevice= getIntent().getParcelableExtra(ModuleActivity.EXTRA_BLE_DEVICE);
}

From source file:com.transistorsoft.cordova.bggeo.CDVBackgroundGeolocation.java

public void onHttpResponse(Bundle event) {
    PluginResult result;/*from  w  ww.j  ava2 s . c  o  m*/
    try {
        JSONObject params = new JSONObject();
        params.put("status", event.getInt("status"));
        params.put("responseText", event.getString("responseText"));
        result = new PluginResult(PluginResult.Status.OK, params);
    } catch (JSONException e) {
        e.printStackTrace();
        result = new PluginResult(PluginResult.Status.JSON_EXCEPTION, e.getMessage());
    }
    result.setKeepCallback(true);
    for (CallbackContext callback : httpResponseCallbacks) {
        callback.sendPluginResult(result);
    }
}

From source file:com.allwinner.theatreplayer.launcher.activity.LaunchActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    getScreenSizeOfDevice2();/*  w w  w  .  j  a  v  a  2s.c  o  m*/
    setContentView(R.layout.activity_view_pager);
    if (savedInstanceState != null) {
        mSaveInt = savedInstanceState.getInt(Key_Int);
    }
    mLauncherModel = LauncherApp.getInstance().getModel();
    bIsShowing = true;
    LIMITED_TASK_EXECUTOR = (ExecutorService) Executors.newFixedThreadPool(4);
    initData();
    initViewPager();
    initViews();
    setViewListener();
    resgisterAllReceiver();
    startUpdateService();
    startOrientatorService();
    startClearMemoryService();

    if (LoadLauncherConfig.loadConfigFromSysXml(this)) {
        mLiveAppAuthorized = true;//open live mask
        mDBHelper.saveLiveAuthorized(true);
    }
    mViewPager.setPageTransformer(true, new FadePageTransformer());

    //?

}