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.ateam.alleneatonautorentals.SalesSearchCar.java

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

    Intent getIntent = getIntent();
    keyword = getIntent.getStringExtra("key");
    userEmail = getIntent.getStringExtra("email");
    keyUser = getIntent.getStringExtra("keyUser");
    name = getIntent.getStringExtra("name");
    carsList = new ArrayList<HashMap<String, String>>();

    new LoadFoundCars().execute();

    ListView lv = getListView();//from   w  w w.  j  a  v a  2 s .c  o m

    lv.setOnItemClickListener(new OnItemClickListener() {

        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            Intent ii = new Intent(getApplicationContext(), SalesCheckoutCar.class);
            String carid = ((TextView) view.findViewById(R.id.car_id_list)).getText().toString();

            ii.putExtra("carid", carid);
            ii.putExtra("reservation", "0");
            ii.putExtra("email", userEmail);
            ii.putExtra("key", keyword);
            ii.putExtra("name", name);

            startActivity(ii);
            finish();
        }

    });
}

From source file:de.damdi.fitness.activity.settings.sync.OpenTrainingSyncService.java

protected void onHandleIntent(Intent intent) {
    Log.d(TAG, "onHandleIntent()");

    version = intent.getIntExtra(EXTRA_VERSION_CODE, -1);
    host = intent.getStringExtra(EXTRA_HOST);

    mReceiver = intent.getParcelableExtra("receiver");
    String command = intent.getStringExtra("command");
    Bundle b = new Bundle();
    if (command.equals("query")) {
        try {//from  w w  w. ja va2 s  .  c om

            // set up REST-Client
            mClient = new RestClient(host, port, "https", version);

            // download and parse the exercises
            ArrayList<ExerciseType> allExercises = downloadAndParseExercises();

            // add data to bundle
            b.putSerializable("all_exercises", allExercises);

            mReceiver.send(STATUS_FINISHED, b);
        } catch (Exception e) {
            Log.e(TAG, "Error, could not get exercises from server: " + e.toString(), e);
            b.putString(Intent.EXTRA_TEXT, e.toString());
            mReceiver.send(STATUS_ERROR, b);
        }
    }
    this.stopSelf();
}

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

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

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

    new LoadFoundCars().execute();

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

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

        lv.setOnItemClickListener(new OnItemClickListener() {

            @Override/*from  w  w  w  . ja va 2s  .  com*/
            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
                String model = ((TextView) view.findViewById(R.id.car_model_list)).getText().toString();
                String make = ((TextView) view.findViewById(R.id.car_make_list)).getText().toString();
                String carid = ((TextView) view.findViewById(R.id.car_id_list)).getText().toString();
                Intent ii = new Intent(getApplicationContext(), ServiceCarMenu.class);

                ii.putExtra(TAG_MODEL, model);
                ii.putExtra(TAG_MAKE, make);
                ii.putExtra(TAG_ID, carid);
                ii.putExtra("key", keyword);

                startActivity(ii);
                finish();
            }

        });
    }
}

From source file:org.geometerplus.android.fbreader.network.AuthenticationActivity.java

@Override
public void onCreate(Bundle icicle) {
    super.onCreate(icicle);
    Thread.setDefaultUncaughtExceptionHandler(
            new org.geometerplus.zlibrary.ui.android.library.UncaughtExceptionHandler(this));
    setResult(RESULT_CANCELED);//from  www. j a  v  a  2s  . c o  m
    setContentView(R.layout.authentication);

    final Intent intent = getIntent();
    final String host = intent.getStringExtra(HOST_KEY);
    final String area = intent.getStringExtra(AREA_KEY);
    final String username = intent.getStringExtra(USERNAME_KEY);
    final String error = intent.getStringExtra(ERROR_KEY);
    final boolean showSignupLink = intent.getBooleanExtra(SHOW_SIGNUP_LINK_KEY, false);

    myResource = ZLResource.resource("dialog").getResource("AuthenticationDialog");

    setTitle(host != null ? host : myResource.getResource("title").getValue());

    if (area != null && !"".equals(area)) {
        findTextView(R.id.authentication_subtitle).setText(area);
    } else {
        findTextView(R.id.authentication_subtitle).setVisibility(View.GONE);
    }
    final TextView warningView = findTextView(R.id.authentication_unencrypted_warning);
    if ("https".equalsIgnoreCase(intent.getStringExtra(SCHEME_KEY))) {
        warningView.setVisibility(View.GONE);
    } else {
        warningView.setText(myResource.getResource("unencryptedWarning").getValue());
    }
    findTextView(R.id.authentication_username_label).setText(myResource.getResource("login").getValue());
    findTextView(R.id.authentication_password_label).setText(myResource.getResource("password").getValue());

    final TextView usernameView = findTextView(R.id.authentication_username);
    usernameView.setText(username);

    final TextView errorView = findTextView(R.id.authentication_error);
    if (error != null && !"".equals(error)) {
        errorView.setVisibility(View.VISIBLE);
        errorView.setText(error);
    } else {
        errorView.setVisibility(View.GONE);
    }

    if (showSignupLink) {
        findViewById(R.id.authentication_signup_box).setVisibility(View.VISIBLE);
        final TextView signupView = (TextView) findViewById(R.id.authentication_signup);
        signupView.setText(myResource.getResource("register").getValue());
        signupView.setOnClickListener(new View.OnClickListener() {
            public void onClick(View view) {
                setResult(RESULT_SIGNUP);
                finish();
            }
        });
    } else {
        findViewById(R.id.authentication_signup_box).setVisibility(View.GONE);
    }

    final ZLResource buttonResource = ZLResource.resource("dialog").getResource("button");

    final Button okButton = findButton(R.id.authentication_ok_button);
    okButton.setText(buttonResource.getResource("ok").getValue());
    okButton.setOnClickListener(new Button.OnClickListener() {
        public void onClick(View v) {
            final Intent data = new Intent();
            data.putExtra(USERNAME_KEY, usernameView.getText().toString());
            data.putExtra(PASSWORD_KEY, findTextView(R.id.authentication_password).getText().toString());
            setResult(RESULT_OK, data);
            finish();
        }
    });

    final Button cancelButton = findButton(R.id.authentication_cancel_button);
    cancelButton.setText(buttonResource.getResource("cancel").getValue());
    cancelButton.setOnClickListener(new Button.OnClickListener() {
        public void onClick(View v) {
            finish();
        }
    });
}

From source file:com.dragondevs.pubnubexample.DrawingActivity.java

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

    Intent intent = getIntent();
    channelName = intent.getStringExtra("CHANNEL");

    //Create Handler to update screen from PubnubClient
    mHandler = new Handler(Looper.getMainLooper()) {
        @Override//  ww  w  . ja  v  a2s  .  com
        public void handleMessage(Message inputMessage) {
            if (inputMessage.obj instanceof JSONObject) {
                JSONObject json = (JSONObject) inputMessage.obj;
                int x = -1;
                int y = -1;
                int state = -1;
                try {
                    x = json.getInt("X");
                    y = json.getInt("Y");
                    state = json.getInt("STATE");
                } catch (JSONException e) {
                    Log.d(TAG, "Error: " + e.toString());
                }
                Log.d(TAG, "Drawing coord at x, y, state: " + x + " " + y + " " + state);
                if (x >= 0 && y >= 0 && state >= 0)
                    myView.drawLine(x, y, state);
                else
                    Log.d(TAG, "Json values read was not valid");
            }
        }
    };

    myView = new MyView(this, mHandler);

    setContentView(myView);

    mPaint = new Paint();
    mPaint.setAntiAlias(true);
    mPaint.setDither(true);
    mPaint.setColor(0xFFFF0000);
    mPaint.setStyle(Paint.Style.STROKE);
    mPaint.setStrokeJoin(Paint.Join.ROUND);
    mPaint.setStrokeCap(Paint.Cap.ROUND);
    mPaint.setStrokeWidth(12);

}

From source file:com.google.android.panoramio.ImageGrid.java

private void handleIntent(Intent intent) throws IOException, URISyntaxException, JSONException {
    if (Intent.ACTION_SEARCH.equals(intent.getAction())) {
        query = intent.getStringExtra(SearchManager.QUERY);
    } else {/*www .  j a v a  2  s . c om*/
        query = intent.getStringExtra("query");
    }

    if (query == null || query.isEmpty()) {
        query = DEFAULT_QUERY;
    }
    // Start downloading
    mImageManager.load(query);
}

From source file:com.kinvey.sample.signin.GoogleLoginActivity.java

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    if (requestCode == GPLAY_REQUEST_CODE && resultCode == RESULT_OK) {
        mAccount = data.getStringExtra(AccountManager.KEY_ACCOUNT_NAME);
        get(PLUS_PEOPLE_ME, mAccount, SCOPE_STRING, null, new ResponseHandler() {

            @Override/*from w w  w .j a  v  a  2  s  .co  m*/
            public void handle(Response response) {
                if (response.status != 200) {
                    error(response);
                    return;
                }
                try {
                    JSONObject json = new JSONObject(new String(response.body));
                    mID = json.optString("id");

                    loginGoogleKinveyUser();

                } catch (JSONException je) {
                    throw new RuntimeException(je);
                }
            }

        });
    }
}

From source file:cn.count.easydrive366.DriverLicenseEditActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.modules_edit_driverlicense_activity);
    this.setupLeftButton();
    Intent intent = this.getIntent();
    String data = intent.getStringExtra("data");
    try {/*from   www.ja va2  s  . c o  m*/
        JSONObject json = new JSONObject(data);
        initView(json);
    } catch (JSONException e) {
        log(e);
    }

}

From source file:net.olejon.mdapp.Icd10SearchActivity.java

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

    // Intent//from   w w w .  ja va2 s.  c  o m
    final Intent intent = getIntent();

    mSearchString = intent.getStringExtra("search");

    // Layout
    setContentView(R.layout.activity_icd10_search);

    // Toolbar
    final Toolbar toolbar = (Toolbar) findViewById(R.id.icd10_search_toolbar);
    toolbar.setTitle(getString(R.string.icd10_search_search) + ": \"" + mSearchString + "\"");

    setSupportActionBar(toolbar);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);

    // Progress bar
    mProgressBar = (ProgressBar) findViewById(R.id.icd10_search_toolbar_progressbar);
    mProgressBar.setVisibility(View.VISIBLE);

    // List
    mListView = (ListView) findViewById(R.id.icd10_search_list);
    mListViewEmpty = findViewById(R.id.icd10_search_list_empty);

    // Get search
    GetSearchTask getSearchTask = new GetSearchTask();
    getSearchTask.execute();
}

From source file:cn.count.easydrive366.signup.Step3Activity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    this._isHideTitleBar = true;
    super.onCreate(savedInstanceState);

    setContentView(R.layout.modules_step3_activity);
    this.setupLeftButton();
    this.setRightButtonInVisible();
    this.setupPhoneButtonInVisible();
    btnNext = (Button) findViewById(R.id.btn_ok);
    edtName = (EditText) findViewById(R.id.edt_name);
    edtCar_type = (EditText) findViewById(R.id.edt_car_type);
    edtInit_date = (EditText) findViewById(R.id.edt_init_date);

    btnNext.setOnClickListener(new OnClickListener() {

        @Override/*w  w  w .java2 s. c  o m*/
        public void onClick(View v) {
            nextStep();

        }
    });
    findViewById(R.id.row_init_date).setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            chooseDate(edtInit_date);

        }
    });
    findViewById(R.id.row_car_type).setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            chooseDriverType();

        }
    });

    Intent intent = this.getIntent();
    edtName.setText(intent.getStringExtra("name"));
    edtCar_type.setText(intent.getStringExtra("car_type"));
    edtInit_date.setText(intent.getStringExtra("init_date"));
    this.get(AppSettings.url_get_license_type(), 2, "");
}