Example usage for android.widget TextView getText

List of usage examples for android.widget TextView getText

Introduction

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

Prototype

@ViewDebug.CapturedViewProperty
public CharSequence getText() 

Source Link

Document

Return the text that TextView is displaying.

Usage

From source file:net.idlesoft.android.apps.github.activities.Dashboard.java

@Override
protected void onSaveInstanceState(final Bundle outState) {
    final TextView postTitle = (TextView) findViewById(R.id.tv_dashboard_latestPost_title);
    final TextView postLink = (TextView) findViewById(R.id.tv_dashboard_latestPost_link);

    outState.putString("postTitle", postTitle.getText().toString());
    outState.putString("postLink", postLink.getText().toString());

    super.onSaveInstanceState(outState);
}

From source file:io.github.protino.codewatch.ui.ProfileActivity.java

private void removeViewIfNoData(TextView view) {
    String text = view.getText().toString();
    if (text.isEmpty() || text.contentEquals("null")) {
        view.setVisibility(View.GONE);
    }/*from   w w w.j  av  a2  s  .co  m*/
}

From source file:net.alchemiestick.katana.winehqappdb.filter_dialog.java

public filter_dialog(Context cx, List<NameValuePair> data) {
    super(cx);/*from   ww w  .  j a  v  a 2 s .c o  m*/
    this.cx = cx;
    this.webData = data;
    this.requestWindowFeature(Window.FEATURE_NO_TITLE);
    vocl = new View.OnClickListener() {
        public void onClick(View v) {
            onCheckboxClick(v);
        }
    };

    maxLines = new OnEditorActionListener() {
        @Override
        public boolean onEditorAction(TextView tv, int action, KeyEvent key) {
            boolean handled = false;
            if (action == EditorInfo.IME_ACTION_DONE) {
                setMaxLines(tv.getText().toString());
                tv.setText(getNamedData("iPage"));
                InputMethodManager imm = (InputMethodManager) tv.getContext()
                        .getSystemService(Context.INPUT_METHOD_SERVICE);
                imm.hideSoftInputFromWindow(tv.getWindowToken(), 0);
                handled = true;
            }
            return handled;
        }
    };
    rateListener = new AdapterView.OnItemSelectedListener() {
        public void onItemSelected(AdapterView<?> parent, View view, int pos, long id) {
            rateSelected((String) parent.getItemAtPosition(pos));
        }

        public void onNothingSelected(AdapterView<?> parent) {
        }
    };
    licenseListener = new AdapterView.OnItemSelectedListener() {
        public void onItemSelected(AdapterView<?> parent, View view, int pos, long id) {
            licenseSelected((String) parent.getItemAtPosition(pos));
        }

        public void onNothingSelected(AdapterView<?> parent) {
        }
    };
    placementListener = new AdapterView.OnItemSelectedListener() {
        public void onItemSelected(AdapterView<?> parent, View view, int pos, long id) {
            placementSelected((String) parent.getItemAtPosition(pos));
        }

        public void onNothingSelected(AdapterView<?> parent) {
        }
    };

}

From source file:com.anxpp.blog.fragment.SandboxFragment.java

private void saveStringPrefState(Bundle outState, int prefValue) {
    final TextView viewValue = (TextView) viewRoot.findViewById(prefValue);
    outState.putString(String.valueOf(prefValue), viewValue.getText().toString());
}

From source file:com.arquitetaweb.restaurantes.fragment.CardapioFragment.java

private void carregarDadosJson(final View view) {

    handler = new Handler();

    progressDialog = new ProgressDialog(contexto);
    progressDialog.setCancelable(false);
    progressDialog.setMessage("atualizando mapa das mesas...");
    progressDialog.show();/*from www . ja  v  a 2  s  . com*/

    Thread thread = new Thread() {
        public void run() {
            if (Utils.isConnected(contexto)) {
                String url = Utils.getUrlServico(contexto) + "/Api/SituacaoMesas";
                JSONParser jParser = new JSONParser();
                json = jParser.getJSONFromUrl(url);

                contexto.runOnUiThread(new Runnable() {
                    public void run() {
                        ArrayList<HashMap<String, String>> mesasLista = new ArrayList<HashMap<String, String>>();
                        for (int i = 0; i < json.length(); i++) {
                            try {
                                JSONObject c = json.getJSONObject(i);

                                HashMap<String, String> map = new HashMap<String, String>();

                                map.put(KEY_ID, c.getString(KEY_ID));
                                map.put(KEY_NUMEROMESA, c.getString(KEY_NUMEROMESA));
                                map.put(KEY_CODIGOEXTERNO, c.getString(KEY_CODIGOEXTERNO));
                                map.put(KEY_SITUACAO, c.getString(KEY_SITUACAO));

                                mesasLista.add(map);
                            } catch (JSONException e) {
                                e.printStackTrace();
                            }
                        }

                        mesas = (GridView) view.findViewById(R.id.list);
                        adapter = new MesaAdapter(contexto, mesasLista);
                        mesas.setAdapter(adapter);

                        // Click event for single list row
                        mesas.setOnItemClickListener(new OnItemClickListener() {
                            @Override
                            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {

                                TextView idItem = (TextView) view.findViewById(R.id.idItem);

                                Bundle bun = new Bundle();
                                bun.putString("id", (String) idItem.getText());

                                abrirDetalhes(view, bun);
                            }

                            private void abrirDetalhes(View view, Bundle bun) {
                                Intent intent = new Intent(view.getContext(), DetailsActivity.class);
                                intent.putExtras(bun);
                                startActivityForResult(intent, 100);
                            }
                        });
                        progressDialog.dismiss();
                    }
                });

            } else {
                contexto.runOnUiThread(new Runnable() {
                    public void run() {
                        progressDialog.dismiss();
                        new Alerta(contexto, "", "No Foi Localizado o Servidor!" + "\nCausas:"
                                + "\nConexo OK?" + "\nServidor correto?");
                        //                          Toast.makeText(contexto, "No Foi Localizado o Servidor!",
                        //                            Toast.LENGTH_LONG).show();                          
                        //Intent intent = new Intent("settings://sandbox");
                        //startActivity(intent);
                    }
                });
            }
        }
    };
    thread.start();
}

From source file:es.uja.photofirma.android.LoginActivity.java

/**
 * Se ejecuta al pulsar el boton de 'Acceder' en la interfaz grfica, inicia el proceso de acceso al sistema
 *
 *//*from  w w  w  .j av  a2 s.  c o  m*/
public void onDoLogin(View view) {
    loginButton.setVisibility(LinearLayout.VISIBLE);
    tLoginText.setVisibility(TextView.INVISIBLE);
    tConnectingText.setVisibility(TextView.VISIBLE);
    lpb.setVisibility(LinearLayout.VISIBLE);

    TextView user_text_view = (TextView) findViewById(R.id.loginActivityEmailTextEdit);
    TextView password_text_view = (TextView) findViewById(R.id.loginActivityPasswordTextEdit);

    userEmail = user_text_view.getText().toString();
    passLength = password_text_view.getText().toString().length();
    userPassword = StringMD.getStringMessageDigest(password_text_view.getText().toString(), StringMD.SHA512);

    if (userEmail.length() == 0) {
        loginButton.setVisibility(LinearLayout.INVISIBLE);
        loginButtonError.setVisibility(LinearLayout.VISIBLE);
        lButtonErrorText.setText(R.string.sign_up_activity_email_required);
    } else if (passLength < 8) {
        loginButton.setVisibility(LinearLayout.INVISIBLE);
        loginButtonError.setVisibility(LinearLayout.VISIBLE);
        lButtonErrorText.setText(R.string.signup_activity_password_required);
    } else {
        new DoLogin().execute(URL_DO_LOGIN);
    }

}

From source file:org.maikelwever.droidpile.SendMailActivity.java

public String getSubject() {
    TextView v = (TextView) findViewById(R.id.sendViewSubject);
    return v.getText().toString();
}

From source file:org.maikelwever.droidpile.SendMailActivity.java

public String getBody() {
    TextView v = (TextView) findViewById(R.id.sendViewMessage);
    return v.getText().toString();
}

From source file:br.unisinos.evertonlucas.passshelter.app.UsersNewGroupActivity.java

public void btnClearUserGroup(View view) {
    RelativeLayout layout = (RelativeLayout) view.getParent();
    TextView txtUserGroup = (TextView) layout.getChildAt(0);
    ParseUser user = null;/*from w w w  . ja  v a 2 s .  c  o m*/
    for (ParseUser userList : emailUsersGroup) {
        if (userList.getEmail().trim().equals(txtUserGroup.getText().toString()))
            user = userList;
    }
    if (user != null) {
        emailUsersGroup.remove(user);
        refreshListAdapter();
    }
}

From source file:org.deviceconnect.android.uiapp.fragment.profile.PhoneProfileFragment.java

@Override
public View onCreateView(final LayoutInflater inflater, final ViewGroup container,
        final Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    View view = inflater.inflate(R.layout.fragment_phone_service, container, false);
    view.setBackgroundColor(getResources().getColor(android.R.color.background_light));

    final TextView num = (TextView) view.findViewById(R.id.fragment_phone_number);

    final OnClickListener l = new OnClickListener() {
        @Override/* www . j  a  va2s  .  com*/
        public void onClick(final View v) {
            String phone = num.getText().toString();
            int id = v.getId();
            if (id == R.id.fragment_phone_1) {
                phone += "1";
            } else if (id == R.id.fragment_phone_2) {
                phone += "2";
            } else if (id == R.id.fragment_phone_3) {
                phone += "3";
            } else if (id == R.id.fragment_phone_4) {
                phone += "4";
            } else if (id == R.id.fragment_phone_5) {
                phone += "5";
            } else if (id == R.id.fragment_phone_6) {
                phone += "6";
            } else if (id == R.id.fragment_phone_7) {
                phone += "7";
            } else if (id == R.id.fragment_phone_8) {
                phone += "8";
            } else if (id == R.id.fragment_phone_9) {
                phone += "9";
            } else if (id == R.id.fragment_phone_a) {
                phone += "*";
            } else if (id == R.id.fragment_phone_0) {
                phone += "0";
            } else if (id == R.id.fragment_phone_s) {
                phone += "#";
            } else if (id == R.id.fragment_phone_clear) {
                phone = "";
            }
            num.setText(phone);
        }
    };

    int[] ids = { R.id.fragment_phone_1, R.id.fragment_phone_2, R.id.fragment_phone_3, R.id.fragment_phone_4,
            R.id.fragment_phone_5, R.id.fragment_phone_6, R.id.fragment_phone_7, R.id.fragment_phone_8,
            R.id.fragment_phone_9, R.id.fragment_phone_a, R.id.fragment_phone_0, R.id.fragment_phone_s,
            R.id.fragment_phone_clear };

    for (int i = 0; i < ids.length; i++) {
        Button btn = (Button) view.findViewById(ids[i]);
        btn.setOnClickListener(l);
    }

    Button send = (Button) view.findViewById(R.id.fragment_phone_send);
    send.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(final View v) {
            callPhone(num.getText().toString());
        }
    });
    return view;
}