android-edittext

EditText with textPassword inputType, but without Softkeyboard

非 Y 不嫁゛ 提交于 2019-12-02 07:44:53
i wanted to create an EditText with an android:inputType="textPassword. However i also do not want to use the SoftKeyboard for input. So i tried setting InputMethod to null, but this would also disable the textPassword features of replacing password rendering to " * [lastchar]". Is there any other way to disable the softKeyboard from showing up? Uhm just figured it out myself: Simply use: pinInput.setOnClickListener(new OnClickListener() { public void onClick(View v) { InputMethodManager mgr = (InputMethodManager) Pin.this.getSystemService(Context.INPUT_METHOD_SERVICE); mgr

How to know, from addTextChangedListener, how the text has changed

匆匆过客 提交于 2019-12-02 07:15:51
问题 I have a screen with an EditText and a ListView. As you type into the EditText, an AsyncTask is launched (any existing AsyncTask is cancelled and tossed) to query locally for some data to display in the ListView. If the EditText is empty of text, all data is queried for and displayed. Essentially, the EditText is a filter of the data on the screen. This is easy to do. In the addTextChangedListener, simply cancel your previous AsyncTask, launch a new one, and pass to it s.toString(). When the

Getting a NumberFormatException from a numerical EditText field

谁说胖子不能爱 提交于 2019-12-02 07:12:28
I'm trying to create a for -loop to add views to a layout. The for -loop is working fine (I tried it with initialized variables) but I need to get an integer from an EditText . I used a try-catch and LogCat tells me the following... java.lang.NumberFormatException: invalid int "". The website developers.android.com says this is from incorrectly converting a string to an integer, but I don't understand how I could be incorrectly getting the data from the EditText . This is my code... public class UserPref2Activity extends Activity { @Override public void onCreate(Bundle savedInstanceState) {

Android EditText native selector

随声附和 提交于 2019-12-02 06:19:16
问题 I try to apply my own design to edittext and to use android native selector when my edittext is enabled, focused, etc. The problem is that every time I touch the edittext and the native selector is working my edittext becomes smaller. Can anyone please suggest why this is happening?Here is my code snippet: <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_window_focused="false" android:state_enabled="true" android:drawable="@android:drawable/edit_text"/

How to display, on MainActivity, the number inserted on a custom alertDialogFragment with EditText?

↘锁芯ラ 提交于 2019-12-02 06:14:57
I'm using a custom alertdialog with an editText to insert a number, the alertdialog is working, but nothing happens when I click positive button, it should display the value inserted, in main_activity.xml . It seems that my interface is not working. I don't know what I'm doing wrong, here is my code: TestAlertDialogFragment.java public class TestAlertDialogFragment extends DialogFragment { // Use this instance of the interface to deliver action events TestAlertDialogListener mListener; public interface TestAlertDialogListener { public void onDialogPositiveClick(DialogFragment dialog, int i,

EditText unable to change the text color

放肆的年华 提交于 2019-12-02 06:07:22
I;m trying to change text color in EditText like this <EditText android:id="@+id/txtUserName" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_margin="5dp" android:gravity="right" android:hint="@string/hint_user_name" android:textColor="#B49228FF" > <requestFocus /> </EditText> <EditText android:id="@+id/txtPassword" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_marginTop="50px" android:gravity="right" android:hint="@string/hint_password" android:inputType="textPassword" android:textColor="#B49228" /> but it doesn

“EditText and TextView” formatted with thousands separators (,) in android

寵の児 提交于 2019-12-02 05:16:59
问题 I want a thousands separator (,) in EditText when i am typing in editText. after that,i will do some operation on the number.then show the result in the TextView by thousands separator (,). this is my code: public class Mainactivity extends Activity { /** Called when the activity is first created. */ EditText edt; TextView txt; Button btn; OnClickListener myclick = new OnClickListener() { @Override public void onClick(View arg0) { // my calculation double num1 = Double.parseDouble(edt.getText

left drawable alignment with text in android

那年仲夏 提交于 2019-12-02 05:08:06
问题 I am new to custom view and didn't know much about canvas in android, I wanted to align a left drawable to right side of layout along with the text(whether multiline or not) of same textview as in this image In the above image, i wanted to align $ image along with text($20.0 -$90.0 /hour) and must be in center if text is multiline and i don't want to use any extra layouts. Thanks in advance This is my basic xml, <RelativeLayout android:layout_width="match_parent" android:layout_height="wrap

Editable text view with spinner android

让人想犯罪 __ 提交于 2019-12-02 05:07:11
问题 I want to create a control in android where user can input through keyboard or enter through drop down list(spinner). Actually the values I hard code in array in spinner is not exhaustive, so user should have the option to input through virtual keyboard also. So Either user can enter through keyboard or select from list? How can i achieve this in android? 回答1: You can build your own view: public class ServerPreference extends DialogPreference { private String value; private EditText editText;

Textwatcher giving Stackoverflow error

梦想的初衷 提交于 2019-12-02 04:51:38
i am making a length converter which uses TextWatcher. the shortened code is v1.addTextChangedListener(new TextWatcher() { @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { } @Override public void onTextChanged(CharSequence s, int start, int before, int count) { val1=Double.parseDouble(v1.getText().toString()); val2=InchToCm(val1); val3=InchToMl(val1); val4=InchToKm(val1); val5=InchToM(val1); val6=InchToY(val1); val7=InchToFt(val1); val8=InchToLg(val1); val9=InchToLgn(val1); val11=InchTomm(val1); val12=InchToNm(val1); v2. setText(Double.toString(val2));