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.microsoft.office365.msgraphsnippetapp.SnippetDetailFragment.java

@Override
public void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);
    if (null != mStatusColor.getTag()) {
        outState.putInt(STATUS_COLOR, (Integer) mStatusColor.getTag());
    }//from   ww  w.  j  av  a  2s .  com
}

From source file:com.pseudosudostudios.jdd.activities.GameActivity.java

/**
 * Launches the win screen flow, including dealing with Facebook
 *///from w w  w .  ja  v  a 2s .  co m
public void win(int moves) {
    new File(getFilesDir(), saveDataFileName).delete();
    Log.i("Win", "Time: " + bg.getTimeSinceStart());
    Bundle bundle = new Bundle();
    bundle.putInt(WinActivity.moveKey, moves);
    bundle.putString(WinActivity.levelKey, bg.getDifficulty().toString());
    bundle.putLong(WinActivity.timeKey, ((System.currentTimeMillis() - bg.startTime)));
    startActivityForResult(new Intent(this, WinActivity.class).putExtras(bundle), LAUNCH_WIN);
}

From source file:gov.wa.wsdot.android.wsdot.ui.FerriesRouteSchedulesDaySailingsFragment.java

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

    String terminalNames = scheduleDateItems.get(0).getFerriesTerminalItem().get(position)
            .getDepartingTerminalName() + " to "
            + scheduleDateItems.get(0).getFerriesTerminalItem().get(position).getArrivingTerminalName();

    Bundle b = new Bundle();
    Intent intent = new Intent(getActivity(), FerriesRouteSchedulesDayDeparturesActivity.class);
    b.putString("terminalNames", terminalNames);
    b.putInt("position", position);
    b.putSerializable("scheduleDateItems", scheduleDateItems);
    intent.putExtras(b);/* w  w w  . ja v  a  2s .  c  om*/
    startActivity(intent);
}

From source file:pffy.mobile.flax.FlaxActivity.java

@Override
protected void onSaveInstanceState(Bundle savedInstanceState) {

    super.onSaveInstanceState(savedInstanceState);

    savedInstanceState.putInt(getResources().getString(R.string.prefkey_int_foodcatid), this.mFoodCatId);
    savedInstanceState.putInt(getResources().getString(R.string.prefkey_int_fooditemid), this.mFoodItemId);

    savedInstanceState.putString(getResources().getString(R.string.prefkey_str_foodnames),
            this.getOutputNames());
    savedInstanceState.putString(getResources().getString(R.string.prefkey_str_foodfacts),
            this.getOutputFacts());
}

From source file:fr.cph.chicago.activity.BusActivity.java

@Override
public void onSaveInstanceState(Bundle savedInstanceState) {
    savedInstanceState.putInt("busStopId", mBusStopId);
    savedInstanceState.putString("busRouteId", mBusRouteId);
    savedInstanceState.putString("bound", mBound);
    savedInstanceState.putString("busStopName", mBusStopName);
    savedInstanceState.putString("busRouteName", mBusRouteName);
    savedInstanceState.putDouble("latitude", mLatitude);
    savedInstanceState.putDouble("longitude", mLongitude);
    super.onSaveInstanceState(savedInstanceState);
}

From source file:fr.cph.chicago.activity.BusBoundActivity.java

@Override
public final void onCreate(final Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    ChicagoTracker.checkBusData(this);
    if (!this.isFinishing()) {
        setContentView(R.layout.activity_bus_bound);

        if (mBusRouteId == null && mBusRouteName == null && mBound == null) {
            mBusRouteId = getIntent().getExtras().getString("busRouteId");
            mBusRouteName = getIntent().getExtras().getString("busRouteName");
            mBound = getIntent().getExtras().getString("bound");
        }/*w w  w. ja v  a 2  s.  c o  m*/
        mAdapter = new BusBoundAdapter(mBusRouteId);
        setListAdapter(mAdapter);
        getListView().setOnItemClickListener(new AdapterView.OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> adapterView, View view, int position, long id) {
                BusStop busStop = (BusStop) mAdapter.getItem(position);
                Intent intent = new Intent(ChicagoTracker.getAppContext(), BusActivity.class);

                Bundle extras = new Bundle();
                extras.putInt("busStopId", busStop.getId());
                extras.putString("busStopName", busStop.getName());
                extras.putString("busRouteId", mBusRouteId);
                extras.putString("busRouteName", mBusRouteName);
                extras.putString("bound", mBound);
                extras.putDouble("latitude", busStop.getPosition().getLatitude());
                extras.putDouble("longitude", busStop.getPosition().getLongitude());

                intent.putExtras(extras);
                intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                startActivity(intent);
                overridePendingTransition(R.anim.slide_in, R.anim.slide_out);
            }
        });

        EditText filter = (EditText) findViewById(R.id.bus_filter);
        filter.addTextChangedListener(new TextWatcher() {
            List<BusStop> busStopsFiltered;

            @Override
            public void beforeTextChanged(CharSequence s, int start, int count, int after) {
                busStopsFiltered = new ArrayList<BusStop>();
            }

            @Override
            public void onTextChanged(CharSequence s, int start, int before, int count) {
                for (BusStop busStop : mBusStops) {
                    if (StringUtils.containsIgnoreCase(busStop.getName(), s)) {
                        this.busStopsFiltered.add(busStop);
                    }
                }
            }

            @Override
            public void afterTextChanged(Editable s) {
                mAdapter.update(busStopsFiltered);
                mAdapter.notifyDataSetChanged();
            }
        });

        getActionBar().setDisplayHomeAsUpEnabled(true);
        new BusBoundAsyncTask().execute();

        // Preventing keyboard from moving background when showing up
        getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN);
    }
}

From source file:com.kuaichumen.whistle.admin.CaptureActivity.java

@Override
public void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);
    outState.putInt("isLoginOut", type);
}

From source file:my.home.lehome.service.SendMsgIntentService.java

private void saveAndNotify(Intent intent, String result) {
    Context context = getApplicationContext();
    int rep_code = -1;
    String desc;/*from   w  w w  .jav  a2 s .  com*/
    try {
        JSONObject jsonObject = new JSONObject(result);
        rep_code = jsonObject.getInt("code");
        desc = jsonObject.getString("desc");
    } catch (JSONException e) {
        e.printStackTrace();
        desc = context.getString(R.string.chat_error_json);
    }

    Messenger messenger;
    if (intent.hasExtra("messenger"))
        messenger = (Messenger) intent.getExtras().get("messenger");
    else
        messenger = null;

    Message repMsg = Message.obtain();
    repMsg.what = MSG_END_SENDING;

    ChatItem item = intent.getParcelableExtra("pass_item");
    ChatItem newItem = null;
    if (item != null) {
        if (rep_code == 200) {
            item.setState(Constants.CHATITEM_STATE_SUCCESS);
            DBStaticManager.updateChatItem(context, item);
        } else {
            if (rep_code == 415) {
                item.setState(Constants.CHATITEM_STATE_SUCCESS);
            } else {
                item.setState(Constants.CHATITEM_STATE_ERROR);
            }
            DBStaticManager.updateChatItem(context, item);

            newItem = new ChatItem();
            newItem.setContent(desc);
            newItem.setType(ChatItemConstants.TYPE_SERVER);
            newItem.setState(Constants.CHATITEM_STATE_ERROR); // always set true
            newItem.setDate(new Date());
            DBStaticManager.addChatItem(context, newItem);
        }
    } else {
        if (rep_code != 200) {
            Log.d(TAG, result);
            newItem = new ChatItem();
            newItem.setContent(getString(R.string.loc_send_error) + ":" + desc); // TODO - not only loc report
            newItem.setType(ChatItemConstants.TYPE_SERVER);
            newItem.setState(Constants.CHATITEM_STATE_SUCCESS); // always set true
            newItem.setDate(new Date());
            DBStaticManager.addChatItem(context, newItem);
        }
    }

    Log.d(TAG, "dequeue item: " + item);
    if (item == null)
        return;

    Bundle bundle = new Bundle();
    bundle.putParcelable("item", item);
    if (newItem != null)
        bundle.putParcelable("new_item", newItem);
    bundle.putInt("rep_code", rep_code);
    if (messenger != null) {
        repMsg.setData(bundle);
        try {
            messenger.send(repMsg);
        } catch (RemoteException e) {
            e.printStackTrace();
        }
    } else {
        Log.d(TAG, "messager is null, send broadcast instead:" + ACTION_SEND_MSG_END);
        Intent newIntent = new Intent(ACTION_SEND_MSG_END);
        newIntent.putExtras(bundle);
        sendBroadcast(newIntent);
    }
}

From source file:edu.stanford.mobisocial.dungbeetle.ImageGalleryActivity.java

@Override
protected void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);
    outState.putInt("selection", mGallery.getSelectedItemPosition());
}

From source file:com.nextgis.uikobserver.HttpSendData.java

@Override
protected Void doInBackground(String... urls) {
    if (IsNetworkAvailible(mContext)) {
        String sPostBody = urls[0];

        // Create a new HttpClient and Post Header
        HttpClient httpclient = new DefaultHttpClient();

        HttpPost httppost = new HttpPost("http://gis-lab.info:8090/");

        HttpParams params = httppost.getParams();
        params.setParameter(ClientPNames.HANDLE_REDIRECTS, Boolean.FALSE);

        HttpContext localContext = new BasicHttpContext();

        try {/*w w  w. j  a  v a2s .  c  om*/
            StringEntity se = new StringEntity(sPostBody, "UTF8");
            se.setContentEncoding(new BasicHeader(HTTP.CONTENT_TYPE, "application/json"));
            httppost.setEntity(se);
            httppost.setHeader("Content-type", "application/json");

            // Execute HTTP Post Request
            HttpResponse response = httpclient.execute(httppost, localContext);

            Bundle bundle = new Bundle();
            if (response.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
                bundle.putBoolean("error", false);
            } else {
                bundle.putBoolean("error", true);
            }

            bundle.putInt("src", mnType);
            Message msg = new Message();
            msg.setData(bundle);
            if (mEventReceiver != null) {
                mEventReceiver.sendMessage(msg);
            }

        } catch (ClientProtocolException e) {
            mError = e.getMessage();
            cancel(true);
        } catch (IOException e) {
            mError = e.getMessage();
            cancel(true);
        }
    } else {
        Bundle bundle = new Bundle();
        bundle.putBoolean("error", true);
        bundle.putString("err_msq", mContext.getString(R.string.sNetworkUnreach));
        bundle.putInt("src", mnType);

        Message msg = new Message();
        msg.setData(bundle);
        if (mEventReceiver != null) {
            mEventReceiver.sendMessage(msg);
        }
    }
    return null;
}