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:com.glasshack.checkmymath.CheckMyMath.java

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    if (requestCode == TAKE_PICTURE_REQUEST && resultCode == RESULT_OK) {
        String picturePath = data.getStringExtra(CameraManager.EXTRA_PICTURE_FILE_PATH);
        processPictureWhenReady(picturePath);
    }//  w  w w .  j a va 2 s.  c  o  m

    super.onActivityResult(requestCode, resultCode, data);
}

From source file:most.voip.example.remote_config.MainActivity.java

public void loadConfig(View view) {
    Log.d(TAG, "Called loadConfig");
    TextView txtAccount = (TextView) findViewById(R.id.txt_webserver_ip);
    serverIp = txtAccount.getText().toString();
    serverPort = 8000;// w w w  .  ja v a2 s. c  o  m

    Intent intent = getIntent();
    String ipAddress = intent.getStringExtra("ip_address");
    Log.d(TAG, "IpAddress: " + ipAddress);
    String accessToken = intent.getStringExtra("access_token");

    this.configServer = new ConfigServer(this, serverIp, serverPort, accessToken);

    Listener<JSONObject> listener = new Listener<JSONObject>() {

        @Override
        public void onResponse(JSONObject response) {
            Log.d(TAG, "Query Response::" + response);
            try {
                Log.d(TAG, "Accounts" + response.getJSONObject("data").getJSONArray("accounts"));
                accounts = response.getJSONObject("data").getJSONArray("accounts");
                updateAccountsArray();
            } catch (JSONException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
                Log.e(TAG, "error:" + e);
            }

        }
    };
    ErrorListener errorListener = new ErrorListener() {

        @Override
        public void onErrorResponse(VolleyError arg0) {
            // TODO Auto-generated method stub

        }
    };
    this.configServer.getAccounts(listener, errorListener);
}

From source file:com.google.android.apps.muzei.featuredart.FeaturedArtSource.java

@Override
protected void onHandleIntent(Intent intent) {
    if (BuildConfig.DEBUG && intent != null && "demoartwork".equals(intent.getAction())) {
        publishArtwork(new Artwork.Builder().imageUri(Uri.parse(intent.getStringExtra("image")))
                .title(intent.getStringExtra("title")).token(intent.getStringExtra("image"))
                .byline(intent.getStringExtra("byline"))
                .viewIntent(new Intent(Intent.ACTION_VIEW, Uri.parse(intent.getStringExtra("details"))))
                .build());/*from   ww  w .  j  a va2s. co  m*/
        removeAllUserCommands();
    }

    super.onHandleIntent(intent);
}

From source file:net.olejon.spotcommander.DonateActivity.java

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    if (requestCode == 1) {
        final String purchaseData = data.getStringExtra("INAPP_PURCHASE_DATA");

        if (resultCode == RESULT_OK) {
            try {
                final JSONObject purchaseDataJsonObject = new JSONObject(purchaseData);
                final String purchaseToken = purchaseDataJsonObject.getString("purchaseToken");

                consumeDonation(purchaseToken);

                mTools.showToast(getString(R.string.donate_thank_you), 1);

                finish();//  w  ww.  j a v a2 s.c o  m
            } catch (Exception e) {
                mTools.showToast(getString(R.string.donate_something_went_wrong), 1);

                Log.e("DonateActivity", Log.getStackTraceString(e));
            }
        }
    }
}

From source file:com.scigames.registration.Registration5EmailActivity.java

/** Called with the activity is first created. */
@Override/*w w  w .jav  a2s .c  om*/
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    Log.d(TAG, "super.OnCreate");

    Intent i = getIntent();
    Log.d(TAG, "getIntent");
    firstNameIn = i.getStringExtra("fName");
    lastNameIn = i.getStringExtra("lName");
    studentIdIn = i.getStringExtra("studentId");
    visitIdIn = i.getStringExtra("visitId");
    Log.d(TAG, "...getStringExtra");

    // Inflate our UI from its XML layout description.
    setContentView(R.layout.registration5_email);
    Log.d(TAG, "...setContentView");

    email = (EditText) findViewById(R.id.email);
    /* to hide the keyboard on launch, then open when tap in firstname field */
    // email.setInputType(InputType.TYPE_NULL);
    email.setOnTouchListener(new View.OnTouchListener() {
        public boolean onTouch(View v, MotionEvent event) {
            //email.setInputType(InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS);
            email.setInputType(InputType.TYPE_TEXT_VARIATION_WEB_EMAIL_ADDRESS);
            email.setInputType(InputType.TYPE_TEXT_VARIATION_URI);
            email.onTouchEvent(event); // call native handler
            return true; // consume touch even
        }
    });

    Log.d(TAG, "...instantiateEditTexts");

    //display name in greeting sentence
    Resources res = getResources();
    TextView greets = (TextView) findViewById(R.id.greeting);
    greets.setText(String.format(res.getString(R.string.greeting), firstNameIn, lastNameIn));
    Log.d(TAG, greets.toString());
    Log.d(TAG, "...Greetings");

    // Hook up button presses to the appropriate event handler.
    //((Button) findViewById(R.id.back)).setOnClickListener(mBackListener);
    ((Button) findViewById(R.id.continue_button)).setOnClickListener(mContinueButtonListener);
    Log.d(TAG, "...instantiateButtons");

    //set listener
    task.setOnResultsListener(this);
}

From source file:de.hackerspacebremen.push.PushIntentService.java

@Override
protected void onMessage(final Context context, final Intent intent) {
    Log.w("Nokia Push-Message", "Received message");
    final String payload = intent.getStringExtra("payload");
    Log.d("Nokia Push-Message", "dmControl: payload = " + payload);
    try {//w  ww.  j  av a  2s . co  m

        SpaceData data = SpaceDataJsonParser.parse(new JSONObject(payload));

        SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(context);

        final DataEvent statusEvent = (DataEvent) EventBus.getDefault().getStickyEvent(DataEvent.class);
        EventBus.getDefault().postSticky(new DataEvent(data));
        if (statusEvent != null && data.isSpaceOpen() != statusEvent.getData().isSpaceOpen()) {
            EventBus.getDefault().postSticky(new StatusChanged(data.isSpaceOpen()));
        }

        if (settings.getBoolean("notification_preference", true)) {
            this.displayNotification(context, data, settings.getBoolean("vibration_preference", true),
                    settings.getBoolean("permanent_notification_preference", false));
        }

        updateDashClockWidget(context, data);
        updateAppWidget(context, data);

    } catch (JSONException e) {
        Log.e("NokiaPush-Message", "JSON-Exception occured!");
    }
}

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

@Override
protected void onNewIntent(Intent intent) {
    super.onNewIntent(intent);
    cid = intent.getIntExtra("cid", -1);
    bid = intent.getIntExtra("bid", -1);
    to = intent.getStringExtra("to");
    server = new ServersDataSource.Server();
    server.cid = cid;//from   w  w  w .j  a v  a2 s  .  co  m

    setTitle("Reply to " + to + " (" + intent.getStringExtra("network") + ")");
}

From source file:com.gigathinking.simpleapplock.Upgrade.java

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    if (requestCode == 777) {
        if (resultCode == RESULT_OK) {
            int responseCode = data.getIntExtra("RESPONSE_CODE", 0);
            String purchaseData = data.getStringExtra("INAPP_PURCHASE_DATA");
            String dataSignature = data.getStringExtra("INAPP_DATA_SIGNATURE");
            if (responseCode == 0) {
                try {
                    JSONObject jo = new JSONObject(purchaseData);
                    String sku = jo.getString("productId");
                    if (sku.equals("no_ads")) {
                        mPrefs.edit().putBoolean("no_ads_purchased", true).commit();
                    }/* w  w  w  .j  ava2s .  co  m*/
                    if (sku.equals("adv_prot")) {
                        mPrefs.edit().putBoolean("adv_prot_purchased", true).commit();
                    }
                    Toast.makeText(this, getString(R.string.upgrage_on_next_restart), Toast.LENGTH_LONG).show();
                } catch (JSONException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}

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

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

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

    resList = new ArrayList<HashMap<String, String>>();

    new LoadAllUserRes().execute();

    ListView lv = getListView();/*from w w w.  ja va 2  s  . c om*/

    lv.setOnItemClickListener(new OnItemClickListener() {

        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            String card_number = ((TextView) view.findViewById(R.id.list_contract_cardnumber)).getText()
                    .toString();
            String carid = ((TextView) view.findViewById(R.id.list_contract_car_id)).getText().toString();
            String car_type = ((TextView) view.findViewById(R.id.list_contract_car_type)).getText().toString();
            String car_make = ((TextView) view.findViewById(R.id.list_contract_car_make)).getText().toString();
            String car_model = ((TextView) view.findViewById(R.id.list_contract_car_model)).getText()
                    .toString();
            String car_year = ((TextView) view.findViewById(R.id.list_contract_car_year)).getText().toString();
            String license_plate = ((TextView) view.findViewById(R.id.list_contract_license_plate)).getText()
                    .toString();
            String license_state = ((TextView) view.findViewById(R.id.list_contract_license_state)).getText()
                    .toString();
            String employee_email = ((TextView) view.findViewById(R.id.list_contract_employee_email)).getText()
                    .toString();
            String state = ((TextView) view.findViewById(R.id.list_contract_state)).getText().toString();
            String city = ((TextView) view.findViewById(R.id.list_contract_city)).getText().toString();
            String start_date = ((TextView) view.findViewById(R.id.list_contract_start_date)).getText()
                    .toString();
            String end_date = ((TextView) view.findViewById(R.id.list_contract_end_date)).getText().toString();
            String gps = ((TextView) view.findViewById(R.id.list_contract_gps)).getText().toString();
            String child_seat = ((TextView) view.findViewById(R.id.list_contract_child_seat)).getText()
                    .toString();
            String k_tag = ((TextView) view.findViewById(R.id.list_contract_ktag)).getText().toString();
            String assistance = ((TextView) view.findViewById(R.id.list_contract_assistance)).getText()
                    .toString();
            String dinsurance = ((TextView) view.findViewById(R.id.list_contract_dinsurance)).getText()
                    .toString();
            String ainsurance = ((TextView) view.findViewById(R.id.list_contract_ainsurance)).getText()
                    .toString();
            String checkin = ((TextView) view.findViewById(R.id.list_contract_checkin_date)).getText()
                    .toString();

            Intent ii = new Intent(getApplicationContext(), SalesPrintContract.class);

            ii.putExtra("cardnumber", card_number);
            ii.putExtra("carid", carid);
            ii.putExtra("cartype", car_type);
            ii.putExtra("carmake", car_make);
            ii.putExtra("carmodel", car_model);
            ii.putExtra("caryear", car_year);
            ii.putExtra("lplate", license_plate);
            ii.putExtra("lstate", license_state);
            ii.putExtra("ktag", k_tag);
            ii.putExtra("eemail", employee_email);
            ii.putExtra("state", state);
            ii.putExtra("city", city);
            ii.putExtra("start_date", start_date);
            ii.putExtra("end_date", end_date);
            ii.putExtra("gps", gps);
            ii.putExtra("child_seat", child_seat);
            ii.putExtra("ktag", k_tag);
            ii.putExtra("assistance", assistance);
            ii.putExtra("dinsurance", dinsurance);
            ii.putExtra("ainsurance", ainsurance);
            ii.putExtra("checkin", checkin);
            ii.putExtra("email", userEmail);
            ii.putExtra("key", key);
            ii.putExtra("name", name);

            startActivity(ii);
            finish();
        }

    });
}

From source file:com.etime.TimeAlarmService.java

@Override
protected void onHandleIntent(Intent intent) {
    try {//  ww w  .  j a v a 2 s  . c om
        nm = (NotificationManager) this.getSystemService(Context.NOTIFICATION_SERVICE);
        boolean retval;

        loginName = intent.getStringExtra(USERNAME);
        password = intent.getStringExtra(PASSWORD);

        LOGIN_URL = lockContext.getString(R.string.login_url);
        LOGIN_URL_STEP2 = lockContext.getString(R.string.login_url2);
        TIMECARD_URL = lockContext.getString(R.string.timecard_url);
        TIMESTAMP_RECORD_URL = lockContext.getString(R.string.timestamp_record_url);
        LOGIN_FAILED = lockContext.getString(R.string.login_failed_str);

        retval = login();

        if (!retval) {
            notifyAutoClockOutFailure();
        }

        parseTimeCard();

        retval = clockOut();

        if (!retval) {
            notifyAutoClockOutFailure();
        } else {
            notifyAutoClockOutSuccess();
        }
    } finally {
        TimeAlarmService.getLock().release();
    }
}