Example usage for android.os Bundle putString

List of usage examples for android.os Bundle putString

Introduction

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

Prototype

public void putString(@Nullable String key, @Nullable String value) 

Source Link

Document

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

Usage

From source file:com.gimranov.zandy.app.LookupActivity.java

/**
 * Implementation of the OnClickListener interface, to handle button events.
 * //from www .  j a va  2 s .  co m
 * Note: When adding a button, it needs to be added here, but the
 * ClickListener needs to be set in the main onCreate(..) as well.
 */
public void onClick(View v) {
    Log.d(TAG, "Click on: " + v.getId());
    if (v.getId() == R.id.lookupButton) {
        Log.d(TAG, "Trying to start search activity");
        TextView field = (TextView) findViewById(R.id.identifier);
        Editable fieldContents = (Editable) field.getText();
        Bundle b = new Bundle();
        b.putString("mode", "isbn");
        b.putString("identifier", fieldContents.toString());
        this.b = b;
        showDialog(DIALOG_PROGRESS);
    } else {
        Log.w(TAG, "Uncaught click on: " + v.getId());
    }
}

From source file:com.facebook.samples.sessionlogin.LoginUsingActivityActivity.java

public void getFrinedsBirthDays() {
    Session session = Session.getActiveSession();
    //Session.NewPermissionsRequest newPermissionsRequest=new Session.NewPermissionsRequest(this,Arrays.asList("friends_birthday"));
    //session.requestNewReadPermissions(newPermissionsRequest);
    String fqlQuery = "select uid, name,birthday, is_app_user from user where uid in (select uid2 from friend where uid1 = me())";
    Bundle params = new Bundle();
    params.putString("q", fqlQuery);

    session = Session.getActiveSession();
    com.facebook.Request request = new com.facebook.Request(session, "/fql", params, HttpMethod.GET,
            new com.facebook.Request.Callback() {

                @Override/*from w w  w  .  ja va 2  s .  c o  m*/
                public void onCompleted(Response response) {
                    try {
                        GraphObject go = response.getGraphObject();
                        JSONObject jso = go.getInnerJSONObject();
                        JSONArray jarray = jso.getJSONArray("data");
                        for (int i = 0; i < jarray.length(); i++) {

                            JSONObject jObject = (JSONObject) jarray.get(i);
                            list.add(jObject.getString("name") + jObject.get("birthday"));
                            Log.v("info", jObject.getString("name") + jObject.get("birthday"));

                        }
                    } catch (JSONException e) {
                        // TODO Auto-generated catch block
                        e.printStackTrace();
                    }
                    Log.v("birthdays", response.toString());
                    showDialog();

                }
            });
    com.facebook.Request.executeBatchAsync(request);
}

From source file:com.eTilbudsavis.sdkdemo.Search.java

private void performSearch(String query) {

    /*/*  w  ww .  j a  v a 2  s  . c om*/
     * Create a new Listener.
     * 
     * This is a JSONArray listener, and it's therefore important
     * to request an API endpoint that returns valid JSONArray data,
     * or you will get a ParseError.
     */
    Listener<JSONArray> offerListener = new Listener<JSONArray>() {

        @Override
        public void onComplete(JSONArray response, EtaError error) {

            if (mPd != null) {
                mPd.dismiss();
            }

            /* 
             * Determining the state of the request response is simple.
             * 
             * If it's a successful request, the response will be populated
             * and the error object will be null. And if the request failed
             * the error object will be populated, and the request will be
             * null.
             * 
             */
            if (response != null) {

                /*
                 * Generate object from the JSONArray, with the factory method
                 * in the Offer object.
                 */
                mOffers = Offer.fromJSON(response);
                mListView.setAdapter(new SearchAdapter());

            } else {

                /*
                 * If the request failed, you can print the error message
                 */
                EtaLog.d(TAG, "", error);
            }

        }
    };

    Bundle args = new Bundle();
    args.putString(Param.QUERY, query);

    // Create the request
    JsonArrayRequest offerRequest = new JsonArrayRequest(Endpoint.OFFER_SEARCH, offerListener);
    offerRequest.putQueryParameters(args);

    // Send the request to the SDK for execution
    Eta.getInstance().add(offerRequest);

}

From source file:com.QuarkLabs.BTCeClient.fragments.HistoryFragment.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    mDateFormat = android.text.format.DateFormat.getDateFormat(getActivity());
    mHistoryType = (ListType) getArguments().getSerializable(mListTypeTag);
    mLoaderId = mHistoryType.ordinal();/*from   ww  w . j  a  v  a 2  s  . c om*/
    //if we have StartDate and EndDate selected before
    if (savedInstanceState != null) {
        try {
            mStartDateValue = mDateFormat.parse(savedInstanceState.getString("startDate"));
            mEndDateValue = mDateFormat.parse(savedInstanceState.getString("endDate"));
        } catch (ParseException e) {
            e.printStackTrace();
        }
    } else {
        Calendar calendar = Calendar.getInstance();
        mStartDateValue = new Date(calendar.getTimeInMillis() - WEEK);
        mEndDateValue = new Date(calendar.getTimeInMillis());
    }

    //creating bundle for loader
    Bundle bundle = new Bundle();
    bundle.putString("startDate", String.valueOf(mStartDateValue.getTime() / 1000));
    bundle.putString("endDate", String.valueOf(mEndDateValue.getTime() / 1000));
    getLoaderManager().initLoader(mLoaderId, bundle, this);
}

From source file:com.aikidonord.fragments.FragmentDate.java

@Override
/**//from w  w  w  .j a  v  a2 s .co  m
 * Au clic sur un lment de la liste.
 */
public void onListItemClick(ListView l, View v, int position, long id) {

    String date = (String) l.getItemAtPosition(position);

    FragmentManager fm = getFragmentManager();

    if (fm.findFragmentById(R.id.fragment_prochains_stages) != null) {

        // affichage tablette
        mCallback.onDateSelected(date);

    } else {

        // dans le cas de l'affichage tlphone classique

        Intent i = new Intent(this.getActivity(), com.aikidonord.ProchainsStages.class);
        // donnes  envoyer  l'activit
        Bundle b = new Bundle();
        b.putString("type", "date");
        b.putString("data", String.valueOf(date));
        i.putExtras(b);
        this.getActivity().startActivity(i);

    }

}

From source file:com.aikidonord.fragments.FragmentLieu.java

@Override
/**/*from   w  ww  .j  a  v  a 2s.  co m*/
 * Au clic sur un lment de la liste.
 */
public void onListItemClick(ListView l, View v, int position, long id) {

    String lieu = (String) l.getItemAtPosition(position);

    FragmentManager fm = getFragmentManager();

    if (fm.findFragmentById(R.id.fragment_prochains_stages) != null) {

        // affichage tablette
        mCallback.onLieuSelected(lieu);

    } else {

        // dans le cas de l'affichage tlphone classique

        Intent i = new Intent(this.getActivity(), com.aikidonord.ProchainsStages.class);
        // donnes  envoyer  l'activit
        Bundle b = new Bundle();
        b.putString("type", "lieu");
        b.putString("data", String.valueOf(lieu));
        i.putExtras(b);
        this.getActivity().startActivity(i);

    }

}

From source file:com.aikidonord.fragments.FragmentType.java

@Override
/**/*www.ja  v a 2 s . com*/
 * Au clic sur un lment de la liste.
 */
public void onListItemClick(ListView l, View v, int position, long id) {

    String type = (String) l.getItemAtPosition(position);

    FragmentManager fm = getFragmentManager();

    if (fm.findFragmentById(R.id.fragment_prochains_stages) != null) {

        // affichage tablette
        mCallback.onTypeSelected(type);

    } else {

        // dans le cas de l'affichage tlphone classique

        Intent i = new Intent(this.getActivity(), com.aikidonord.ProchainsStages.class);
        // donnes  envoyer  l'activit
        Bundle b = new Bundle();
        b.putString("type", "type");
        b.putString("data", String.valueOf(type));
        i.putExtras(b);
        this.getActivity().startActivity(i);

    }

}

From source file:net.networksaremadeofstring.cyllell.Search.java

public void PerformSearch(final Boolean Crafted) {
    try {/*from w  ww  .j av  a 2 s.co  m*/
        threadCut = new Cuts(Search.this);

        dialog = new ProgressDialog(this);
        dialog.setTitle("Chef Search");
        dialog.setMessage("Searching for: " + query + "\n\nPlease wait: Prepping Authentication protocols");
        dialog.setIndeterminate(true);
        dialog.show();

        Thread dataPreload = new Thread() {
            public void run() {
                try {
                    JSONObject Nodes;
                    handler.sendEmptyMessage(200);
                    if (Crafted) {
                        Nodes = threadCut.CraftedSearch(query, index);
                    } else {
                        Nodes = threadCut.Search(query, index);
                    }

                    handler.sendEmptyMessage(201);
                    JSONArray rows = Nodes.getJSONArray("rows");
                    for (int i = 0; i < rows.length(); i++) {
                        //Log.i("URI", ((JSONObject) rows.get(i)).getString("name"));
                        listOfNodes.add(new Node(((JSONObject) rows.get(i)).getString("name"), ""));
                    }
                    handler.sendEmptyMessage(202);
                    handler.sendEmptyMessage(0);
                } catch (Exception e) {
                    Message msg = new Message();
                    Bundle data = new Bundle();
                    data.putString("exception", e.getMessage());
                    msg.setData(data);
                    msg.what = 1;
                    handler.sendMessage(msg);
                }

                return;
            }
        };
        dataPreload.start();

    } catch (Exception e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
}

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

@Override
protected void onPostExecute(Void unused) {
    super.onPostExecute(unused);
    if (mbShowProgress) {
        mDownloadDialog.dismiss();/*from   w w w  .  ja  v  a 2  s .co m*/
    }
    if (mError != null) {
        Bundle bundle = new Bundle();
        bundle.putBoolean("error", true);
        bundle.putString("err_msq", mError);
        bundle.putInt("src", mnType);

        Message msg = new Message();
        msg.setData(bundle);
        if (mEventReceiver != null) {
            mEventReceiver.sendMessage(msg);
        }
    } else {
        //Toast.makeText(FireReporter.this, "Source: " + Content, Toast.LENGTH_LONG).show();
    }
}

From source file:com.arquitetaweb.restaurantes.fragment.CardapioFragment.java

private void carregarDadosJson(final View view) {

    handler = new Handler();

    progressDialog = new ProgressDialog(contexto);
    progressDialog.setCancelable(false);
    progressDialog.setMessage("atualizando mapa das mesas...");
    progressDialog.show();//from  w  ww  . j  a v a  2s  . c  o m

    Thread thread = new Thread() {
        public void run() {
            if (Utils.isConnected(contexto)) {
                String url = Utils.getUrlServico(contexto) + "/Api/SituacaoMesas";
                JSONParser jParser = new JSONParser();
                json = jParser.getJSONFromUrl(url);

                contexto.runOnUiThread(new Runnable() {
                    public void run() {
                        ArrayList<HashMap<String, String>> mesasLista = new ArrayList<HashMap<String, String>>();
                        for (int i = 0; i < json.length(); i++) {
                            try {
                                JSONObject c = json.getJSONObject(i);

                                HashMap<String, String> map = new HashMap<String, String>();

                                map.put(KEY_ID, c.getString(KEY_ID));
                                map.put(KEY_NUMEROMESA, c.getString(KEY_NUMEROMESA));
                                map.put(KEY_CODIGOEXTERNO, c.getString(KEY_CODIGOEXTERNO));
                                map.put(KEY_SITUACAO, c.getString(KEY_SITUACAO));

                                mesasLista.add(map);
                            } catch (JSONException e) {
                                e.printStackTrace();
                            }
                        }

                        mesas = (GridView) view.findViewById(R.id.list);
                        adapter = new MesaAdapter(contexto, mesasLista);
                        mesas.setAdapter(adapter);

                        // Click event for single list row
                        mesas.setOnItemClickListener(new OnItemClickListener() {
                            @Override
                            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {

                                TextView idItem = (TextView) view.findViewById(R.id.idItem);

                                Bundle bun = new Bundle();
                                bun.putString("id", (String) idItem.getText());

                                abrirDetalhes(view, bun);
                            }

                            private void abrirDetalhes(View view, Bundle bun) {
                                Intent intent = new Intent(view.getContext(), DetailsActivity.class);
                                intent.putExtras(bun);
                                startActivityForResult(intent, 100);
                            }
                        });
                        progressDialog.dismiss();
                    }
                });

            } else {
                contexto.runOnUiThread(new Runnable() {
                    public void run() {
                        progressDialog.dismiss();
                        new Alerta(contexto, "", "No Foi Localizado o Servidor!" + "\nCausas:"
                                + "\nConexo OK?" + "\nServidor correto?");
                        //                          Toast.makeText(contexto, "No Foi Localizado o Servidor!",
                        //                            Toast.LENGTH_LONG).show();                          
                        //Intent intent = new Intent("settings://sandbox");
                        //startActivity(intent);
                    }
                });
            }
        }
    };
    thread.start();
}