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:gov.wa.wsdot.android.wsdot.ui.MountainPassItemCameraFragment.java

@Override
public void onListItemClick(ListView l, View v, int position, long id) {
    super.onListItemClick(l, v, position, id);

    Bundle b = new Bundle();
    Intent intent = new Intent(getActivity(), CameraActivity.class);
    b.putInt("id", bitmapImages.get(position).getCameraId());
    intent.putExtras(b);/*from w  ww.j av a2s. c  o m*/

    startActivity(intent);
}

From source file:ca.mudar.mtlaucasou.services.SyncService.java

@Override
protected void onHandleIntent(Intent intent) {
    final ResultReceiver receiver = intent.getParcelableExtra(EXTRA_STATUS_RECEIVER);
    if (receiver != null) {
        receiver.send(STATUS_RUNNING, Bundle.EMPTY);
    }//from ww  w.j  a  v a 2s. c o  m

    final Context context = this;

    try {
        // Bulk of sync work, performed by executing several fetches from
        // local and online sources.

        final long startLocal = System.currentTimeMillis();

        /**
         * Five Assets files to load, so progress goes by 20%.
         */
        Bundle bundle = new Bundle();
        bundle.putInt(Const.KEY_BUNDLE_PROGRESS_INCREMENT, 20);

        // Parse values from local cache first, since SecurityServices copy
        // or network might be down.

        receiver.send(STATUS_RUNNING, bundle);
        mLocalExecutor.execute(context, KmlLocalAssets.FIRE_HALLS,
                new RemotePlacemarksHandler(FireHalls.CONTENT_URI, true));

        receiver.send(STATUS_RUNNING, bundle);
        mLocalExecutor.execute(context, KmlLocalAssets.SPVM_STATIONS,
                new RemotePlacemarksHandler(SpvmStations.CONTENT_URI, true));

        receiver.send(STATUS_RUNNING, bundle);
        mLocalExecutor.execute(context, KmlLocalAssets.WATER_SUPPLIES,
                new RemotePlacemarksHandler(WaterSupplies.CONTENT_URI));

        receiver.send(STATUS_RUNNING, bundle);
        mLocalExecutor.execute(context, KmlLocalAssets.EMERGENCY_HOSTELS,
                new RemotePlacemarksHandler(EmergencyHostels.CONTENT_URI));

        receiver.send(STATUS_RUNNING, bundle);
        mLocalExecutor.execute(context, KmlLocalAssets.CONDITIONED_PLACES,
                new RemotePlacemarksHandler(ConditionedPlaces.CONTENT_URI));

        Log.v(TAG, "Sync duration: " + (System.currentTimeMillis() - startLocal) + " ms");

        // TODO: update data from remote source
        // Always hit remote SecurityServices for any updates
        // final long startRemote = System.currentTimeMillis();
        // mRemoteExecutor
        // .executeGet(WORKSHEETS_URL, new
        // RemoteSecurityServicesHandler(mRemoteExecutor));
        // Log.d(TAG, "remote sync took " + (System.currentTimeMillis() -
        // startRemote) + "ms");

    } catch (Exception e) {
        Log.e(TAG, e.getMessage());

        if (receiver != null) {
            /**
             * Pass back error to surface listener
             */
            final Bundle bundle = new Bundle();
            bundle.putString(Intent.EXTRA_TEXT, e.toString());
            receiver.send(STATUS_ERROR, bundle);
        }
    }

    if (receiver != null) {
        receiver.send(STATUS_FINISHED, Bundle.EMPTY);
    }
}

From source file:it.scoppelletti.mobilepower.preference.SeekBarPreference.java

protected void onSaveInstanceState(Bundle outState) {
    outState.putInt(SeekBarPreference.STATE_VALUE, myValue);
}

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

@Override
public void onSaveInstanceState(Bundle state) {
    state.putInt("cid", cid);
    state.putInt("bid", bid);
    state.putString("event", event.toString());
    state.putString("list", list);
    state.putString("mask", mask);
    state.putString("placeholder", placeholder);
    state.putString("title", title);
    state.putString("mode", mode);
}

From source file:com.example.carrie.carrie_test1.scandrug.java

public void geturl() {
    AsyncTask<Integer, Void, Void> task = new AsyncTask<Integer, Void, Void>() {
        @Override//from   w ww  .java  2 s.com
        protected Void doInBackground(Integer... integers) {
            String insertUrl = "http://54.65.194.253/Drug/qrcode.php?urlcode=" + urlcode;
            OkHttpClient client = new OkHttpClient();
            Log.d("uuuuuurl", insertUrl);
            okhttp3.Request request = new okhttp3.Request.Builder().url(insertUrl).build();
            Log.d("okhttpurl", "2222");
            try {
                okhttp3.Response response = client.newCall(request).execute();
                Log.d("okhttpurl", "1111");
                JSONArray array = new JSONArray(response.body().string());
                Log.d("okhttpurl", "33333");
                JSONObject object = array.getJSONObject(0);
                Log.d("okhttpurl", "16666");
                Log.d("okhttpurl", object.getString("id"));
                if ((object.getString("id")).equals("nodata")) {
                    Log.d("okht2tp", "4442222");
                    //normalDialogEvent();
                } else {

                    Log.d("nodata", "noooooooo");
                }

                Log.d("searchtest", array.toString());
                for (int i = 0; i < array.length(); i++) {

                    object = array.getJSONObject(i);

                    mydata = new MyData(object.getInt("id"), object.getString("chineseName"),
                            object.getString("image"), object.getString("indication"),
                            object.getString("englishName"), object.getString("licenseNumber"),
                            object.getString("category"), object.getString("component"),
                            object.getString("maker_Country"), object.getString("applicant"),
                            object.getString("maker_Name"), object.getString("QRCode"));

                }

            } catch (IOException e) {
                e.printStackTrace();
            } catch (JSONException e) {
                e.printStackTrace();
            }
            return null;
        }

        @Override
        protected void onPostExecute(Void aVoid) {
            Intent it = new Intent(scandrug.this, FourthActivity.class);
            Log.d("customadapter2", "2");
            Bundle bundle = new Bundle();
            Log.d("customadapter2", "3");
            bundle.putInt("id", mydata.getId());
            Log.d("customadapter2", "4");
            bundle.putString("image", mydata.getImage_link());
            bundle.putString("chineseName", mydata.getChineseName());
            bundle.putString("indication", mydata.getIndication());
            bundle.putString("englishName", mydata.getEnglishName());
            bundle.putString("licenseNumber", mydata.getLicenseNumber());
            bundle.putString("category", mydata.getCategory());
            bundle.putString("component", mydata.getComponent());
            bundle.putString("maker_Country", mydata.getMaker_Country());
            bundle.putString("applicant", mydata.getApplicant());
            bundle.putString("maker_Name", mydata.getMaker_Name());

            Log.d("customadapter2", "5");
            it.putExtras(bundle);

            startActivity(it);
            Log.d("customadapter2", "6");

        }
    };
    task.execute();

}

From source file:com.nextgis.metroaccess.MetaDownloader.java

@Override
protected void onPostExecute(Void unused) {
    super.onPostExecute(unused);

    DismissDowloadDialog();//from w  w  w . j av a 2s .  c o m

    if (msError != null) {
        if (moEventReceiver != null) {
            Bundle bundle = new Bundle();
            bundle.putBoolean(BUNDLE_ERRORMARK_KEY, true);
            bundle.putString(BUNDLE_MSG_KEY, msError);
            bundle.putInt(BUNDLE_EVENTSRC_KEY, 1);

            Message oMsg = new Message();
            oMsg.setData(bundle);
            moEventReceiver.sendMessage(oMsg);
        }
    }
}

From source file:de.aw.awlib.fragments.AWRemoteFileChooser.java

@Override
protected void setInternalArguments(Bundle args) {
    super.setInternalArguments(args);
    args.putInt(LAYOUT, layout);
    args.putIntArray(VIEWRESIDS, viewResIDs);
    args.putInt(VIEWHOLDERLAYOUT, viewHolderLayout);
}

From source file:dk.kk.ibikecphlib.util.HttpUtils.java

public static Message JSONtoMessage(JsonNode result) {
    Message ret = new Message();
    Bundle data = new Bundle();
    if (result != null) {
        if (result.has("success"))
            data.putBoolean("success", result.get("success").asBoolean());
        if (result.has("info"))
            data.putString("info", result.get("info").asText());
        if (result.has("has_password"))
            data.putBoolean("has_password", result.get("has_password").asBoolean());
        if (result.has("invalid_token")) {
            if (result.get("invalid_token").asBoolean()) {
                data.putBoolean("invalid_token", result.get("invalid_token").asBoolean());
                IBikeApplication.logoutWrongToken();
            }/*www  . j av a 2 s. c  o m*/
        }
        /*if (result.has("errors"))
        data.putString("errors", result.get("errors").get(0).asText());*/
    }
    if (result != null && result.has("data")) {
        JsonNode dataNode = result.get("data");
        if (dataNode != null) {
            if (dataNode.has("id"))
                data.putInt("id", dataNode.get("id").asInt());
            if (dataNode.has("auth_token"))
                data.putString("auth_token", dataNode.get("auth_token").asText());
            if (dataNode.has("signature"))
                data.putString("signature", dataNode.get("signature").asText());
            if (dataNode.has("provider"))
                data.putString("provider", dataNode.get("provider").asText());
            /*if (dataNode.has("errors"))
                data.putString("errors", dataNode.get("errors").get(0).asText());*/
        }
    }

    ret.setData(data);
    return ret;
}

From source file:de.sourcestream.movieDB.controller.GenresList.java

/**
 * Called to ask the fragment to save its current dynamic state,
 * so it can later be reconstructed in a new instance of its process is restarted.
 *
 * @param outState Bundle in which to place your saved state.
 *//*from  w w  w  .ja  va2  s  . c om*/
@Override
public void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);
    // Used to avoid bug where we add item in the back stack
    // and if we change orientation twice the item from the back stack has null values
    if (save != null)
        outState.putBundle("save", save);
    else {
        Bundle send = new Bundle();
        send.putInt("backState", backState);
        if (backState == 1) {
            send.putParcelableArrayList("listData", genresList);
            // used to restore the scroll listener variables
            // Save scroll position
            if (listView != null) {
                Parcelable listState = listView.onSaveInstanceState();
                send.putParcelable("listViewScroll", listState);
            }

        }
        outState.putBundle("save", send);

    }
}