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:net.reichholf.dreamdroid.activities.SearchEpgActivity.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    Intent intent = getIntent();

    if (Intent.ACTION_SEARCH.equals(intent.getAction())) {
        mQuery = intent.getStringExtra(SearchManager.QUERY);
        setAdapter();/*from   w w  w  .  ja  va 2  s. c om*/
        search();
    } else {
        finish();
    }

}

From source file:com.ec.android.module.bluetooth40.base.BaseBluetoothControlActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    ///* w w w .  j a  v a 2  s .  c om*/
    mLocalBroadcastManager = LocalBroadcastManager.getInstance(getApplicationContext());
    //
    final Intent intent = getIntent();
    mDeviceName = intent.getStringExtra(EXTRAS_DEVICE_NAME);
    mNickName = intent.getStringExtra(EXTRAS_DEVICE_NICK_NAME);
    mDeviceAddress = intent.getStringExtra(EXTRAS_DEVICE_ADDRESS);

    //
    Intent gattServiceIntent = new Intent(this, BluetoothLeService.class);
    bindService(gattServiceIntent, mServiceConnection, BIND_AUTO_CREATE);
}

From source file:hongik.android.project.best.StoreActivity.java

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

    Intent intent = this.getIntent();
    license = intent.getStringExtra("LICENSE");
    menuTable = (TableLayout) findViewById(R.id.store_menu);
    reviewTable = (TableLayout) findViewById(R.id.store_review);

    try {/*from   ww  w .  ja v a  2  s . c  om*/
        drawPage();
    } catch (Exception e) {
        e.printStackTrace();
    }
}

From source file:com.cuddlesoft.norilib.service.ServiceTypeDetectionService.java

@Override
protected void onHandleIntent(Intent intent) {
    // Extract SearchClient.Settings from the received Intent.
    final Uri uri = Uri.parse(intent.getStringExtra(ENDPOINT_URL));
    final Intent broadcastIntent = new Intent(ACTION_DONE);

    if (uri.getHost() == null || uri.getScheme() == null) {
        // The URL supplied is invalid.
        sendBroadcast(broadcastIntent.putExtra(RESULT_CODE, RESULT_FAIL_INVALID_URL));
        return;/*from www  . j a  v a2s  .co m*/
    }

    // Create the HTTP client.
    final OkHttpClient okHttpClient = new OkHttpClient();
    okHttpClient.setConnectTimeout(REQUEST_TIMEOUT, TimeUnit.SECONDS);
    okHttpClient.setReadTimeout(REQUEST_TIMEOUT, TimeUnit.SECONDS);

    // Iterate over supported URI schemes for given URL.
    for (String uriScheme : (TLS_SUPPORT.contains(uri.getHost()) ? URI_SCHEMES_PREFER_SSL : URI_SCHEMES)) {
        String baseUri = uriScheme + uri.getHost();
        // Iterate over each endpoint path.
        for (Map.Entry<SearchClient.Settings.APIType, String> entry : API_ENDPOINT_PATHS.entrySet()) {
            // Create a HTTP request object.
            final Request request = new Request.Builder().url(baseUri + entry.getValue()).build();

            try {
                // Fetch response.
                final Response response = okHttpClient.newCall(request).execute();
                // Make sure the response code was OK and that the HTTP client wasn't redirected along the way.
                if (response.code() == HttpStatus.SC_OK && response.priorResponse() == null) {
                    // Found an API endpoint.
                    broadcastIntent.putExtra(RESULT_CODE, RESULT_OK);
                    broadcastIntent.putExtra(ENDPOINT_URL, baseUri);
                    broadcastIntent.putExtra(API_TYPE, entry.getKey().ordinal());
                    sendBroadcast(broadcastIntent);
                    return;
                }
            } catch (IOException e) {
                // Network error. Notify the listeners and return.
                sendBroadcast(broadcastIntent.putExtra(RESULT_CODE, RESULT_FAIL_NETWORK));
                return;
            }
        }
    }

    // End of the loop was reached without finding an API endpoint. Send error code to the BroadcastReceiver.
    sendBroadcast(broadcastIntent.putExtra(RESULT_CODE, RESULT_FAIL_NO_API));
}

From source file:com.lepin.activity.AddNewCarActivity.java

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    if (resultCode == RESULT_OK && requestCode == 5) {
        String cartype = data.getStringExtra("cartype");
        carTypeId = String.valueOf(data.getIntExtra("typeId", 0));
        addCarType.setText(cartype);//from w ww. j a v a2 s . c  om
    }
    super.onActivityResult(requestCode, resultCode, data);
}

From source file:de.grobox.blitzmail.NotificationHandlerActivity.java

protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    Intent intent = getIntent();
    onNewIntent(intent);/*from   w  w  w .  j av  a2s.  co  m*/

    try {
        if (intent != null) {
            mMail = new JSONObject(intent.getStringExtra("mail"));
        }
    } catch (JSONException e) {
        e.printStackTrace();
    }
}

From source file:com.jesusla.google.BillingReceiver.java

/**
 * This is the entry point for all asynchronous messages sent from Android Market to
 * the application. This method forwards the messages on to the
 * {@link BillingService}, which handles the communication back to Android Market.
 * The {@link BillingService} also reports state changes back to the application through
 * the {@link ResponseHandler}./*from  www .  j  a  va 2  s  .  c  o  m*/
 */
@Override
public void onReceive(Context context, Intent intent) {
    String action = intent.getAction();
    if (Consts.ACTION_PURCHASE_STATE_CHANGED.equals(action)) {
        String signedData = intent.getStringExtra(Consts.INAPP_SIGNED_DATA);
        String signature = intent.getStringExtra(Consts.INAPP_SIGNATURE);
        purchaseStateChanged(context, signedData, signature);
    } else if (Consts.ACTION_NOTIFY.equals(action)) {
        String notifyId = intent.getStringExtra(Consts.NOTIFICATION_ID);
        if (Consts.DEBUG) {
            Log.i(TAG, "notifyId: " + notifyId);
        }
        notify(context, notifyId);
    } else if (Consts.ACTION_RESPONSE_CODE.equals(action)) {
        long requestId = intent.getLongExtra(Consts.INAPP_REQUEST_ID, -1);
        int responseCodeIndex = intent.getIntExtra(Consts.INAPP_RESPONSE_CODE,
                ResponseCode.RESULT_ERROR.ordinal());
        checkResponseCode(context, requestId, responseCodeIndex);
    } else {
        Log.w(TAG, "unexpected action: " + action);
    }
}

From source file:com.popofibo.weatherpop.WeatherPopDisplayActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.activity_display_content);
    Intent intent = getIntent();
    String city = intent.getStringExtra(WeatherPopConstants.EXTRA_MESSAGE);
    option = intent.getStringExtra(WeatherPopConstants.EXTRA_OPTION);
    String lang = "en";

    if (city == null)
        city = "Gurgaon, IN";

    cityText = (TextView) findViewById(R.id.cityText);
    temp = (TextView) findViewById(R.id.temp);
    unitTemp = (TextView) findViewById(R.id.unittemp);
    unitTemp.setText("C");
    unitTemp.setTextColor(Color.parseColor(WeatherPopConstants.TEXT_COLOR));

    imgView = (ImageView) findViewById(R.id.condIcon);
    condDescr = (TextView) findViewById(R.id.condDescr);
    hum = (TextView) findViewById(R.id.hum);
    press = (TextView) findViewById(R.id.press);
    windSpeed = (TextView) findViewById(R.id.windSpeed);
    windDeg = (TextView) findViewById(R.id.windDeg);
    try {// w w  w.j  a va 2 s. c  om
        JSONWeatherTask task = new JSONWeatherTask();
        task.execute(new String[] { city, lang });
    } catch (Exception ex) {
        // System.out.println(ex.getMessage());
        Builder alert = new AlertDialog.Builder(WeatherPopDisplayActivity.this);
        alert.setTitle("You made me crash, man!");
        alert.setMessage("Blast! Something went terribly wrong with the "
                + "request. Check your connection and try again.");
        alert.setPositiveButton("OK", null);
        alert.show();
    }

}

From source file:com.manning.androidhacks.hack023.authenticator.AuthenticatorActivity.java

@Override
public void onCreate(Bundle icicle) {
    super.onCreate(icicle);

    mAccountManager = AccountManager.get(this);
    checkMaximumNumberOfAccounts();/*from   ww w  .  j  av a  2  s  . c o m*/

    final Intent intent = getIntent();

    mUser = intent.getStringExtra(PARAM_USER);
    mAuthTokenType = intent.getStringExtra(PARAM_AUTHTOKEN_TYPE);
    mRequestNewAccount = mUsername == null;
    mConfirmCredentials = intent.getBooleanExtra(PARAM_CONFIRMCREDENTIALS, false);

    Log.i(TAG, "    request new: " + mRequestNewAccount);
    requestWindowFeature(Window.FEATURE_LEFT_ICON);
    setContentView(R.layout.login);
    getWindow().setFeatureDrawableResource(Window.FEATURE_LEFT_ICON, android.R.drawable.ic_dialog_alert);

    findViews();
    initFields();
}

From source file:com.imalu.alyou.activity.RegisterActivity.java

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

    passwordEditText = (EditText) findViewById(R.id.password);
    confirmPwdEditText = (EditText) findViewById(R.id.confirm_password);
    Intent intent = getIntent();
    username = intent.getStringExtra("phone");
    Log.e("~PHONE~", username);
}