Example usage for android.os Bundle putInt

List of usage examples for android.os Bundle putInt

Introduction

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

Prototype

public void putInt(@Nullable String key, int value) 

Source Link

Document

Inserts an int value into the mapping of this Bundle, replacing any existing value for the given key.

Usage

From source file:com.example.main.ViewPagerActivity.java

@Override
public void onSaveInstanceState(Bundle savedInstanceState) {
    // Save away the original text, so we still have it if the activity   
    // needs to be killed while paused.
    super.onSaveInstanceState(savedInstanceState);
    GlobalID globalID = ((GlobalID) getApplication());
    savedInstanceState.putString("ALL_List", Talk2String());
    savedInstanceState.putInt("index", index);
    globalID.create_notification("", "", "", false, false, false,
            ViewPagerActivity.class.getName());
    if (globalID.toast != null)
        globalID.toast.cancel();/*from w  w w.j  a  v a 2 s .co m*/
}

From source file:com.app.uafeed.activity.EditFeedActivity.java

@Override
protected void onSaveInstanceState(Bundle outState) {
    outState.putInt(STATE_CURRENT_TAB, mTabHost.getCurrentTab());
    super.onSaveInstanceState(outState);
}

From source file:com.irccloud.android.activity.PastebinEditorActivity.java

@Override
protected void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);
    outState.putString("paste_contents", paste.getText().toString());
    outState.putString("paste_id", pasteID);
    outState.putString("message", message.getText().toString());
    outState.putString("filename", filename.getText().toString());
    outState.putInt("tab", current_tab);
}

From source file:com.frostwire.android.gui.fragments.ImageViewerFragment.java

@Override
public void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);
    outState.putBundle(EXTRA_FILE_DESCRIPTOR_BUNDLE, fd.toBundle());
    outState.putBoolean(EXTRA_IN_FULL_SCREEN_MODE, inFullScreenMode);
    outState.putInt(EXTRA_ADAPTER_FILE_OFFSET, position);
}

From source file:com.irccloud.android.fragment.UsersListFragment.java

@Override
public void onSaveInstanceState(Bundle state) {
    super.onSaveInstanceState(state);
    state.putInt("cid", cid);
    state.putInt("bid", bid);
    state.putString("channel", channel);
}

From source file:org.dvbviewer.controller.ui.fragments.RecordingList.java

@Override
public boolean onContextItemSelected(android.view.MenuItem item) {
    switch (item.getItemId()) {
    case R.id.menuStream:
        if (item.getMenuInfo() != null) {
            AdapterContextMenuInfo info = (AdapterContextMenuInfo) item.getMenuInfo();
            selectedPosition = info.position;
        }/*from w w w .j a  va 2s  .c  o m*/

        if (UIUtils.isTablet(getActivity())) {
            StreamConfig cfg = StreamConfig.newInstance();
            Bundle arguments = new Bundle();
            arguments.putInt(StreamConfig.EXTRA_FILE_ID, (int) mAdapter.getItem(selectedPosition).getId());
            arguments.putInt(StreamConfig.EXTRA_FILE_TYPE, StreamConfig.FILE_TYPE_RECORDING);
            arguments.putInt(StreamConfig.EXTRA_DIALOG_TITLE_RES, R.string.streamConfig);
            cfg.setArguments(arguments);
            cfg.show(getSherlockActivity().getSupportFragmentManager(), StreamConfig.class.getName());
        } else {
            Intent streamConfig = new Intent(getActivity(), StreamConfigActivity.class);
            streamConfig.putExtra(StreamConfig.EXTRA_FILE_ID, (int) mAdapter.getItem(selectedPosition).getId());
            streamConfig.putExtra(StreamConfig.EXTRA_FILE_TYPE, StreamConfig.FILE_TYPE_RECORDING);
            startActivity(streamConfig);
        }

        return true;

    default:
        break;
    }
    return false;
}

From source file:com.skubit.android.billing.BillingServiceBinder.java

@Override
public Bundle getSkuDetails(int apiVersion, String userId, String packageName, String type, Bundle skusBundle)
        throws RemoteException {
    Bundle bundle = new Bundle();
    if (TextUtils.isEmpty(packageName) || TextUtils.isEmpty(type)) {
        bundle.putInt("RESPONSE_CODE", BillingResponseCodes.RESULT_DEVELOPER_ERROR);
        return bundle;
    }/*from  ww  w  .  j a  va  2s .co  m*/

    if (apiVersion != 1) {
        bundle.putInt("RESPONSE_CODE", BillingResponseCodes.RESULT_BILLING_UNAVAILABLE);
        return bundle;
    }

    if (skusBundle == null || !skusBundle.containsKey("ITEM_ID_LIST")) {
        bundle.putInt("RESPONSE_CODE", BillingResponseCodes.RESULT_DEVELOPER_ERROR);
        return bundle;
    }

    if (!isValidType(type)) {
        bundle.putInt("RESPONSE_CODE", BillingResponseCodes.RESULT_BILLING_UNAVAILABLE);
        return bundle;
    }

    int packValidate = validatePackageIsOwnedByCaller(packageName);
    if (packValidate != BillingResponseCodes.RESULT_OK) {
        bundle.putInt("RESPONSE_CODE", packValidate);
        return bundle;
    }

    String account = userId;
    if (!hasAccess(userId, packageName)) {
        Log.d(TAG, "User account not configured");
        bundle.putInt("RESPONSE_CODE", BillingResponseCodes.RESULT_USER_ACCESS);
        return bundle;
    }
    Utils.changeAccount(mContext, userId);

    InventoryRestService service = new InventoryService(account, mContext).getRestService();

    ArrayList<String> itemIds = skusBundle.getStringArrayList("ITEM_ID_LIST");
    SkuDetailsListDto skuDetailsListDto = null;

    try {
        skuDetailsListDto = service.getSkuDetailsByIds(packageName, Joiner.on(",").join(itemIds));
    } catch (Exception e1) {
        e1.printStackTrace();
        bundle.putInt("RESPONSE_CODE", BillingResponseCodes.RESULT_ERROR);
    }

    ArrayList<String> details = new ArrayList<String>();
    for (SkuDetailsDto skuDetailsDto : skuDetailsListDto.getItems()) {
        JSONObject jo = new JSONObject();
        try {
            jo.put("productId", skuDetailsDto.getProductId());
            jo.put("type", skuDetailsDto.getType().name());
            jo.put("price", String.valueOf(skuDetailsDto.getSatoshi()));
            jo.put("title", skuDetailsDto.getTitle());
            jo.put("description", skuDetailsDto.getDescription());
        } catch (JSONException e) {
            e.printStackTrace();
        }
        details.add(jo.toString());
    }

    bundle.putStringArrayList("DETAILS_LIST", details);
    bundle.putInt("RESPONSE_CODE", BillingResponseCodes.RESULT_OK);

    return bundle;
}

From source file:com.zsxj.pda.ui.client.LoginActivity.java

@Override
public void onReponse(Object id, InputStream data) throws IOException {
    if (null != mUpdateDataId && mUpdateDataId.toString().equals(id.toString())) {

        try {//from  ww  w  .  j  a  v  a  2 s .com
            String rtnData = new String(Util.readDataFromIS(data));
            if (null == rtnData || rtnData.equals("")) {
                sendCheckUpdateRequest();
                return;
            }

            JSONObject result = new JSONObject(rtnData);
            // Message return 
            Bundle bundle = new Bundle();
            bundle.putInt("update_type", result.optJSONObject("init_response").optInt("update_type"));
            bundle.putInt("update_method", result.optJSONObject("init_response").optInt("update_method"));
            bundle.putString("update_url", result.optJSONObject("init_response").optString("update_url"));
            bundle.putString("update_ver", result.optJSONObject("init_response").optString("update_ver"));
            bundle.putLong("update_size", result.optJSONObject("init_response").optLong("update_size"));
            bundle.putString("update_msg", result.optJSONObject("init_response").optString("update_msg"));
            Message message = new Message();
            message.what = HandlerCases.UPDATE_CHECK;
            message.setData(bundle);
            handler.sendMessage(message);
        } catch (Exception e) {
        }
    }
}

From source file:com.orbar.pxdemo.MainActivity.java

private void selectItem(int position) {
    // update the main content by replacing fragments
    fragment = new FivePXBrowseImageListFragment();

    Bundle args = new Bundle();
    args.putInt(FivePXImageListFragment.ARG_CATEGORY,
            ((Category) mDrawerCategoryList.getItemAtPosition(position)).ordinal());

    fragment.setArguments(args);//ww w  .  jav a2s  .  c o m

    FragmentManager fragmentManager = getFragmentManager();
    fragmentManager.beginTransaction().replace(R.id.content_frame, fragment).commit();

    // update selected item and title, then close the drawer
    mDrawerCategoryList.setItemChecked(position, true);

    String selected = ((Category) mDrawerCategoryList.getItemAtPosition(position)).toString();
    setTitle(selected);

    mDrawerLayout.closeDrawer(mDrawerView);
}

From source file:com.hybris.mobile.app.commerce.CommerceApplicationBase.java

public void onCreate() {
    super.onCreate();
    mInstance = this;

    String urlBackend = getStringFromSharedPreferences(getString(R.string.preference_key_value_base_url), "");
    String catalogStore = getStringFromSharedPreferences(getString(R.string.preference_key_value_catalog_store),
            "");//from   w  ww .  j  a v  a2 s.  c om
    String catalogId = getStringFromSharedPreferences(getString(R.string.preference_key_value_catalog_id), "");
    String catalogMainCategory = getStringFromSharedPreferences(
            getString(R.string.preference_key_value_catalog_main_category_id), "");

    // Setting the default backend url
    if (StringUtils.isBlank(urlBackend)) {
        urlBackend = getString(R.string.url_backend);

        int index = ArrayUtils.indexOf(getResources().getStringArray(R.array.backend_url_values), urlBackend);

        // Update the settings
        setStringToSharedPreferences(getString(R.string.preference_key_value_base_url), urlBackend);
        setStringToSharedPreferences(getString(R.string.preference_key_key_base_url),
                getResources().getStringArray(R.array.backend_url_keys)[index]);
    }

    // Setting the default catalog
    if (StringUtils.isBlank(catalogStore)) {
        catalogStore = getString(R.string.url_path_catalog);
        setStringToSharedPreferences(getString(R.string.preference_key_value_catalog_store), catalogStore);
    }

    if (StringUtils.isBlank(catalogId)) {
        catalogId = getString(R.string.url_path_catalog_id);
        setStringToSharedPreferences(getString(R.string.preference_key_value_catalog_id), catalogId);
    }

    if (StringUtils.isBlank(catalogMainCategory)) {
        catalogMainCategory = getString(R.string.id_category_main);
        setStringToSharedPreferences(getString(R.string.preference_key_value_catalog_main_category_id),
                catalogMainCategory);
    }

    // Updating the pre-defined catalog key
    String catalogKey = catalogStore + "|" + catalogId + "|" + catalogMainCategory;
    int index = ArrayUtils.indexOf(getResources().getStringArray(R.array.backend_catalog_values), catalogKey);
    setStringToSharedPreferences(getString(R.string.preference_key_key_catalog),
            getResources().getStringArray(R.array.backend_catalog_keys)[index]);

    // Configuration for the backend url
    com.hybris.mobile.lib.commerce.Configuration configuration = new com.hybris.mobile.lib.commerce.Configuration();
    configuration.setBackendUrl(urlBackend);
    configuration.setCatalogId(catalogId);
    configuration.setCatalog(catalogStore);
    configuration.setCatalogVersionId(mInstance.getString(R.string.url_path_catalog_version_id));
    configuration.setCatalogAuthority(getString(R.string.provider_authority));
    configuration.setCatalogIdMainCategory(catalogMainCategory);

    // Bypassing SSLHelperSyncService
    TrustManager[] trustManager = new TrustManager[] { new X509TrustManager() {
        @Override
        public void checkClientTrusted(java.security.cert.X509Certificate[] chain, String authType) {
        }

        @Override
        public void checkServerTrusted(java.security.cert.X509Certificate[] chain, String authType) {
        }

        @Override
        public java.security.cert.X509Certificate[] getAcceptedIssuers() {
            return null;
        }
    } };

    SSLContext sslContext = null;

    try {
        sslContext = SSLContext.getInstance("SSL");
        sslContext.init(null, trustManager, new java.security.SecureRandom());
    } catch (NoSuchAlgorithmException | KeyManagementException e) {
        Log.e(TAG, "Error with SSLHelperSyncService. Details: " + e.getLocalizedMessage());
    }

    if (sslContext == null) {
        throw new IllegalStateException("Unable to get an instance of SSLContext");
    }

    // Creating the content service helper
    mInstance.mContentServiceHelper = buildContentServiceHelper(configuration, sslContext.getSocketFactory(),
            new HostnameVerifier() {
                @Override
                public boolean verify(String hostname, SSLSession session) {
                    return true;
                }
            });

    // Build the configuration for the app
    mConfiguration = Configuration.buildConfiguration(this);

    // Barcode scanner instance
    mScannerHelper = new ScannerHelper(new CommerceBarcodeCheckerFactory());

    // Register local broadcast to Logout
    LocalBroadcastManager.getInstance(this).registerReceiver(new LogoutBroadcastReceiver(),
            new IntentFilter(getString(R.string.intent_action_logout)));

    // Register local broadcast to update cache on the content service helper
    LocalBroadcastManager.getInstance(this).registerReceiver(new UpdateCacheBroadcastReceiver(),
            new IntentFilter(getString(R.string.intent_action_update_cache)));

    // Default account for the sync adapter
    addCatalogSyncAdapterDefaultAccount();

    // We sync in advance the main category of the catalog to create the sync adapter and accelerate the process
    Bundle bundle = new Bundle();
    bundle.putString(CatalogSyncConstants.SYNC_PARAM_GROUP_ID, catalogMainCategory);
    bundle.putInt(CatalogSyncConstants.SYNC_PARAM_CURRENT_PAGE, 0);
    bundle.putInt(CatalogSyncConstants.SYNC_PARAM_PAGE_SIZE, mConfiguration.getDefaultPageSize());
    requestCatalogSyncAdapter(bundle);
}