Example usage for android.content Intent getStringExtra

List of usage examples for android.content Intent getStringExtra

Introduction

In this page you can find the example usage for android.content Intent getStringExtra.

Prototype

public String getStringExtra(String name) 

Source Link

Document

Retrieve extended data from the intent.

Usage

From source file:mad.codeforcommunity.CalendarView.java

public void onNewIntent(Intent intent) {
    String date = intent.getStringExtra("date");
    String[] dateArr = date.split("-"); // date format is yyyy-mm-dd
    month.set(Integer.parseInt(dateArr[0]), Integer.parseInt(dateArr[1]), Integer.parseInt(dateArr[2]));
}

From source file:emcewen.websms.services.C2DMRegistrationService.java

@Override
protected void onHandleIntent(Intent intent) {
    String action = intent.getAction();

    if (REGISTER_WITH_MYSERVER.equals(action)) {
        this.registerForPush(intent.getStringExtra(REGISTRATION_ID), intent.getStringExtra(PUSH_USERNAME));
    } else if (UNREGISTER_WITH_C2DM.equals(action)) {
        this.unregisterFromC2dm();
    } else if (REGISTER_WITH_C2DM.equals(action)) {
        this.registerToC2dm();
    } else if (UNREGISTER_WITH_MYSERVER.equals(action)) {
        this.unregisterForPush();
    }/*from  w  ww .  ja v  a  2  s .co  m*/

}

From source file:de.steveliedtke.gcm.example.gcm.GCMIntentService.java

@Override
protected void onMessage(final Context context, final Intent intent) {
    Log.w("GCM-Message", "Received message");
    final String payload = intent.getStringExtra("payload");
    Log.d("GCM-Message", "dmControl: payload = " + payload);
    try {/*from  www  .  java  2  s.c o m*/

        SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(context);

        Log.i("GCM-Message", "PAYLOAD: " + payload);
        if (settings.getBoolean("notification_preference", true)) {
            this.displayNotification(context, payload, settings.getBoolean("vibration_preference", true),
                    settings.getBoolean("permanent_notification_preference", false));
        }
    } catch (JSONException e) {
        Log.e("GCM-Message", "JSON-Exception occured!");
    }
}

From source file:com.textuality.gpstats.GPlusSnowflake.java

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    if (requestCode == GPS_REQUEST_CODE && resultCode == RESULT_OK) {
        mAccount = data.getStringExtra(AccountManager.KEY_ACCOUNT_NAME);
        get("https://www.googleapis.com/plus/v1/people/me", mAccount,
                "oauth2:https://www.googleapis.com/auth/plus.me", null, new ResponseHandler() {

                    @Override/* w ww  .  j ava 2 s  . c om*/
                    public void handle(Response response) {
                        if (response.status != 200) {
                            barf(response);
                            return;
                        }
                        try {
                            JSONObject json = new JSONObject(new String(response.body));
                            mID = json.optString("id");
                            readFeedPage(null);
                        } catch (JSONException je) {
                            throw new RuntimeException(je);
                        }
                    }
                });
    }
}

From source file:edu.nyu.cs.omnidroid.app.controller.external.actions.GMailService.java

@Override
public void onStart(Intent intent, int startId) {
    super.onStart(intent, startId);
    this.intent = intent;
    extractUserCredentials();//from  w  ww .j  ava  2  s.  c  om
    to = intent.getStringExtra(SendGmailAction.PARAM_TO);
    subject = intent.getStringExtra(SendGmailAction.PARAM_SUBJECT);
    body = intent.getStringExtra(SendGmailAction.PARAM_BODY);
    send();
}

From source file:org.klnusbaum.udj.network.PlayerCommService.java

private void setPlayerData(Intent intent, AccountManager am, Account account) {
    am.setUserData(account, Constants.PLAYER_NAME_DATA, intent.getStringExtra(Constants.PLAYER_NAME_EXTRA));
    am.setUserData(account, Constants.PLAYER_HOSTNAME_DATA,
            intent.getStringExtra(Constants.PLAYER_OWNER_EXTRA));
    am.setUserData(account, Constants.PLAYER_HOST_ID_DATA,
            intent.getStringExtra(Constants.PLAYER_OWNER_ID_EXTRA));
    am.setUserData(account, Constants.PLAYER_LAT_DATA,
            String.valueOf(intent.getDoubleExtra(Constants.PLAYER_LAT_EXTRA, -100.0)));
    am.setUserData(account, Constants.PLAYER_LONG_DATA,
            String.valueOf(intent.getDoubleExtra(Constants.PLAYER_LONG_EXTRA, -100.0)));
}

From source file:com.example.lista3new.SyncService.java

@Override
protected void onHandleIntent(Intent intent) {
    String host = intent.getStringExtra(MESSAGE_URL);
    String username = intent.getStringExtra(MESSAGE_USERNAME);
    String password = intent.getStringExtra(MESSAGE_PASSOWRD);
    int port = intent.getIntExtra(MESSAGE_PORT, defaultPort);
    Log.d(TAG, "Connecting...");
    if (ftpConnect(host, port, username, password)) {
        syncFiles(ftpGetCurrentDirectory(), path.getPath());
    } else {// w  w  w  .  ja  v  a 2s.  c om
        Log.d(TAG, "Cant connect");
    }

}

From source file:com.mattrayner.vuforia.VuforiaPlugin.java

@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
    String name;/*from   w  ww.ja v a 2 s  .  co m*/

    if (data == null) {
        name = "ERROR";
    } else {
        name = data.getStringExtra("name");
    }

    Log.d(LOGTAG, "Plugin Received: '" + name + "' from Vuforia.");

    // Check which request we're responding to
    if (requestCode == IMAGE_REC_REQUEST) {
        // Make sure the request was successful
        if (resultCode == 0) {
            try {
                JSONObject json = new JSONObject();
                json.put("imageName", name);
                callback.sendPluginResult(new PluginResult(PluginResult.Status.OK, json));
            } catch (JSONException e) {
                Log.d(LOGTAG, "JSON ERROR: " + e);
            }
        } else {
            Log.d(LOGTAG, "Error - received code: " + resultCode);
        }
    }
    vuforiaStarted = false;
}

From source file:com.ateam.alleneatonautorentals.SalesPrintContract.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.sales_print_contract);

    Intent getIntent = getIntent();

    userEmail = getIntent.getStringExtra("email");
    name = getIntent.getStringExtra("name");
    key = getIntent.getStringExtra("key");

    carid = getIntent.getStringExtra("carid");
    gps = getIntent.getStringExtra("gps");
    ktag = getIntent.getStringExtra("ktag");
    childseat = getIntent.getStringExtra("child_seat");
    assistance = getIntent.getStringExtra("assistance");
    dinsurance = getIntent.getStringExtra("dinsurance");
    ainsurance = getIntent.getStringExtra("ainsurance");
    start_date = getIntent.getStringExtra("start_date");
    end_date = getIntent.getStringExtra("end_date");
    city = getIntent.getStringExtra("city");
    state = getIntent.getStringExtra("state");
    eemail = getIntent.getStringExtra("eemail");
    car_type = getIntent.getStringExtra("cartype");
    car_model = getIntent.getStringExtra("carmodel");
    car_make = getIntent.getStringExtra("carmake");
    license_plate = getIntent.getStringExtra("lplate");
    license_state = getIntent.getStringExtra("lstate");
    car_year = getIntent.getStringExtra("caryear");
    checkin = getIntent.getStringExtra("checkin");
    card_number = getIntent.getStringExtra("cardnumber");

    Map<String, Object> params = new HashMap<String, Object>();
    params.put("Car Type", car_type.substring(10));
    params.put("GPS Receiver", gps.substring(5));
    params.put("Child Seats", childseat.substring(12));
    params.put("K-Tag Rental", ktag.substring(7));
    params.put("Roadside Assistance", assistance.substring(17));
    params.put("Loss Damage Waiver Insurance", dinsurance.substring(18));
    params.put("Personal Accident Insurance", ainsurance.substring(20));
    params.put("Start Date", start_date.substring(24));
    params.put("End Date", end_date.substring(22));
    params.put("City", city.substring(18));
    params.put("State", state.substring(19));
    params.put("Checkin Date", checkin.substring(15));

    PriceManager priceManager = new PriceManager(params);
    Double price = priceManager.getContractPrice();
    DecimalFormat df = new DecimalFormat("#.00");

    TextView tview = (TextView) findViewById(R.id.contract_user_name);
    tview.setText(name);//from w ww.  j  a v  a 2s . co  m
    tview = (TextView) findViewById(R.id.contract_user_email);
    tview.setText(userEmail);
    tview = (TextView) findViewById(R.id.contract_card_number);
    tview.setText(card_number);

    tview = (TextView) findViewById(R.id.contract_employee_email);
    tview.setText(eemail);

    tview = (TextView) findViewById(R.id.contract_car_id);
    tview.setText(carid);
    tview = (TextView) findViewById(R.id.contract_car_type);
    tview.setText(car_type);
    tview = (TextView) findViewById(R.id.contract_car_make);
    tview.setText(car_make);
    tview = (TextView) findViewById(R.id.contract_car_model);
    tview.setText(car_model);
    tview = (TextView) findViewById(R.id.contract_car_year);
    tview.setText(car_year);
    tview = (TextView) findViewById(R.id.contract_license_plate);
    tview.setText(license_plate);
    tview = (TextView) findViewById(R.id.contract_license_plate_state);
    tview.setText(license_state);

    tview = (TextView) findViewById(R.id.contract_start_date);
    tview.setText(start_date);
    tview = (TextView) findViewById(R.id.contract_end_date);
    tview.setText(end_date);
    tview = (TextView) findViewById(R.id.contract_city_reservation);
    tview.setText(city);
    tview = (TextView) findViewById(R.id.contract_state_reservation);
    tview.setText(state);
    //tview = (TextView)findViewById(R.id.contract_price);
    //tview.setText(userEmail);
    tview = (TextView) findViewById(R.id.contract_gps);
    tview.setText(gps);
    tview = (TextView) findViewById(R.id.contract_ktag);
    tview.setText(ktag);
    tview = (TextView) findViewById(R.id.contract_child_seat);
    tview.setText(childseat);
    tview = (TextView) findViewById(R.id.contract_assistence);
    tview.setText(assistance);
    tview = (TextView) findViewById(R.id.contract_dinsurance);
    tview.setText(dinsurance);
    tview = (TextView) findViewById(R.id.contract_ainsurance);
    tview.setText(ainsurance);
    tview = (TextView) findViewById(R.id.contract_checkin_date);
    tview.setText(checkin);
    tview = (TextView) findViewById(R.id.total_price);
    tview.setText("$" + df.format(price));
}

From source file:com.ateam.alleneatonautorentals.SalesSearchUser.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.view_users);

    Intent getIntent = getIntent();
    keyword = getIntent.getStringExtra("key");
    Log.d("Key Searched: ", keyword);
    usersList = new ArrayList<HashMap<String, String>>();

    new LoadFoundUsers().execute();

    SessionManager session = new SessionManager(getApplicationContext());
    String role = session.getRole();

    if (role.equals("Sales") || role.equals("Manager")) {
        ListView lv = getListView();

        lv.setOnItemClickListener(new OnItemClickListener() {

            @Override// w w  w  . j  a  v a  2s. c o  m
            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
                String email = (((TextView) view.findViewById(R.id.user_email_list)).getText().toString())
                        .substring(7);
                String name = ((TextView) view.findViewById(R.id.user_name_list)).getText().toString();
                Intent ii = new Intent(getApplicationContext(), SalesUserMenu.class);
                ii.putExtra(TAG_EMAIL, email);
                ii.putExtra("key", keyword);
                ii.putExtra(TAG_NAME, name);
                startActivity(ii);
                finish();
            }

        });
    }

}