Example usage for android.widget EditText getText

List of usage examples for android.widget EditText getText

Introduction

In this page you can find the example usage for android.widget EditText getText.

Prototype

@Override
    public Editable getText() 

Source Link

Usage

From source file:edu.asu.msse.gnayak2.movieapplication.NewMovieHandler.java

public void onSearchMovieMovieClicked(View v) {
    EditText movieTitle = (EditText) findViewById(R.id.new_movie_editText_title);
    String title = movieTitle.getText().toString();

    AsyncConnect asyncConnect = new AsyncConnect(new AsyncConnect.PostExecuteMethodDelegate() {
        @Override/*  www.j  ava2 s  .  com*/
        public void displayMovieDescription(String response) {
            // read response if response is true then set the fields of the edit texts
            //else throw a toast for error
            JSONObject jsonObj = null;
            String responseValue = "";
            try {
                jsonObj = new JSONObject(response);
                responseValue = jsonObj.getString("Response");
            } catch (JSONException e) {
                e.printStackTrace();
            }

            if (responseValue.equals("True")) {
                Movie movie = new Movie(response);
                populateFields(movie);
            } else {
                Toast.makeText(getApplicationContext(), "Movie doesn't exist in OMDB", Toast.LENGTH_SHORT)
                        .show();
            }
        }
    });
    asyncConnect.execute(new String[] { title });
}

From source file:com.springsource.greenhouse.events.sessions.EventSessionRatingActivity.java

private String getComment() {
    EditText editText = (EditText) findViewById(R.id.event_session_rating_text);
    return editText.getText().toString();
}

From source file:net.kourlas.voipms_sms.activities.EditDatabaseActivity.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    ActionBar actionBar = getSupportActionBar();
    if (actionBar != null) {
        switch (item.getItemId()) {
        case R.id.save_button:
            List<Message> messages = new ArrayList<>();
            try {
                EditText editText = (EditText) findViewById(R.id.database_text);
                JSONArray databaseJsonArray = new JSONArray(editText.getText().toString());
                for (int i = 0; i < databaseJsonArray.length(); i++) {
                    JSONObject messageJsonObject = databaseJsonArray.getJSONObject(i);
                    Message message = new Message(messageJsonObject.optLong(Database.COLUMN_DATABASE_ID),
                            messageJsonObject.optLong(Database.COLUMN_VOIP_ID),
                            messageJsonObject.getLong(Database.COLUMN_DATE),
                            messageJsonObject.getLong(Database.COLUMN_TYPE),
                            messageJsonObject.getString(Database.COLUMN_DID),
                            messageJsonObject.getString(Database.COLUMN_CONTACT),
                            messageJsonObject.getString(Database.COLUMN_MESSAGE),
                            messageJsonObject.getLong(Database.COLUMN_UNREAD),
                            messageJsonObject.getLong(Database.COLUMN_DELETED),
                            messageJsonObject.getLong(Database.COLUMN_DELIVERED),
                            messageJsonObject.getLong(Database.COLUMN_DELIVERY_IN_PROGRESS));
                    messages.add(message);
                }/* w w  w  .jav  a2 s  . c o  m*/
            } catch (Exception ex) {
                Utils.showInfoDialog(this, getString(R.string.preferences_database_edit_failure_save));
                return false;
            }

            database.deleteAllMessages();
            for (Message message : messages) {
                database.insertMessage(message);
            }
            finish();
            return true;
        }
    }

    return super.onOptionsItemSelected(item);
}

From source file:com.chess.genesis.activity.RegisterFrag.java

private void register_validate() {
    EditText txt = (EditText) act.findViewById(R.id.username);
    final String username = txt.getText().toString().trim();
    if (!valid_username(username))
        return;/*from  w w  w  . j  a  v a  2s .c  o  m*/

    txt = (EditText) act.findViewById(R.id.password);
    final String password = txt.getText().toString();
    txt = (EditText) act.findViewById(R.id.password2);
    final String password2 = txt.getText().toString();
    if (!valid_password(password, password2))
        return;

    txt = (EditText) act.findViewById(R.id.email);
    final String email = txt.getText().toString().trim();
    if (!valid_email(email))
        return;

    final Bundle bundle = new Bundle();
    bundle.putString("username", username);
    bundle.putString("password", password);
    bundle.putString("email", email);

    new RegisterConfirm(act, handle, bundle).show();
}

From source file:com.drisoftie.cwdroid.frag.DiagLogin.java

@Override
public void buttonPositivePressed() {
    EditText username = (EditText) getDialog().findViewById(R.id.edt_diag_username);
    EditText password = (EditText) getDialog().findViewById(R.id.edt_diag_password);
    if (StringUtils.isNoneEmpty(username.getText(), password.getText())) {
        getResultListener()/*from   www  . java2 s  . c  o  m*/
                .onResultReady(new String[] { username.getText().toString(), password.getText().toString() });
        dismiss();
    } else {
        if (StringUtils.isEmpty(username.getText())) {
            username.setError(getString(R.string.err_no_name));
        }
        if (StringUtils.isEmpty(password.getText())) {
            password.setError(getString(R.string.err_no_password));
        }
    }
}

From source file:com.springsource.greenhouse.authorization.SignInActivity.java

private boolean validateFormData() {
    EditText editText = (EditText) findViewById(R.id.username);
    String username = editText.getText().toString().trim();
    editText = (EditText) findViewById(R.id.password);
    String password = editText.getText().toString().trim();
    if (username.length() > 0 && password.length() > 0) {
        return true;
    }/*from w  ww. ja  v a2s. c  o  m*/
    return false;
}

From source file:com.chess.genesis.activity.MsgBoxFrag.java

@Override
public void onClick(final View v) {
    if (v.getId() == R.id.submit_msg) {
        progress.setText("Sending Message");

        final EditText txt = (EditText) act.findViewById(R.id.new_msg);
        final String msg = txt.getText().toString().trim();

        if (msg.length() < 1)
            return;
        net.submit_msg(gameid, msg);/*w w w. ja v a 2  s .  c o  m*/
        new Thread(net).start();
    } else if (v.getId() == R.id.menu) {
        openMenu(v);
    }
}

From source file:net.mceoin.cominghome.oauth.OAuthFlowApp.java

private void usePincode() {
    EditText editPincode = (EditText) findViewById(R.id.editPincode);
    String pincode = editPincode.getText().toString();
    if (debug)//from   w ww .  java2 s  .  c  o  m
        Log.d(TAG, "pincode=" + pincode);
    new RequestAccessToken().execute(pincode);
}

From source file:bbct.android.common.activity.FilterCards.java

private void onConfirm() {
    Bundle filterArgs = new Bundle();
    FragmentActivity activity = Objects.requireNonNull(getActivity());
    for (int i = 0; i < TEXT_FIELDS.length; i++) {
        EditText input = activity.findViewById(TEXT_FIELDS[i]);
        if (input.isEnabled() && input.getText().toString().length() > 0) {
            String key = EXTRAS[i];
            filterArgs.putString(key, input.getText().toString());
        }/*from w  w  w  . j av a2  s.  co m*/
    }

    BaseballCardList cardList = BaseballCardList.getInstance(filterArgs);
    activity.getSupportFragmentManager().beginTransaction().replace(R.id.fragment_holder, cardList)
            .addToBackStack(FILTERED_LIST).commit();
}

From source file:com.dimasdanz.kendalipintu.util.AdminLoginDialog.java

@Override
protected void onDialogClosed(boolean positiveResult) {
    if (positiveResult) {
        if (SharedPreferencesManager.getIsAdminPrefs(getContext())) {
            SharedPreferencesManager.setAsAdmin(getContext(), false, null);
            Toast.makeText(getContext(), R.string.toast_admin_logout_success, Toast.LENGTH_SHORT).show();
        } else {/* w  w  w .j a  v  a 2  s.c om*/
            EditText username = (EditText) mView.findViewById(R.id.input_username);
            EditText password = (EditText) mView.findViewById(R.id.input_password);
            new sendAdminLogin().execute(username.getText().toString(), password.getText().toString());
        }
    }
}