android-edittext

EditText freezes/doesn't show text whilst typing

余生颓废 提交于 2019-12-04 08:59:09
In my Android application I have an EditText which is sat inside a LinearLayout . This page is used in a ViewPager . On majority of the devices I have tested on, it seems that the EditText behaves perfectly fine, except on a few. It appears that on a few devices, when I touch the EditText and start typing, the text doesn't show but the suggestions do show. It is only after the Keyboard is closed that the text appears within the EditText . Why is this the case? Why does the text not show whilst I type? Why does it show only after I close the keyboard? Code: <RadioGroup android:id="@+id

editText box not working properly. Android

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-04 07:13:23
问题 I'm trying to get values out of edittext boxes and on the click of a button, I want to compare if the text inside the edittext box matches a certain value. If it does, a new intent should be called. If it doesn't it should show an error. Here is my code after the button is clicked... if(v.getId() == R.id.button1){ id = et1.getText().toString(); Toast toast = Toast.makeText(this, "Value of id is: " + id, Toast.LENGTH_SHORT); toast.show(); if(id == "abc"){ Intent i= new Intent(Slogin.this,

Save multiple EditText values using SharedPreferences

两盒软妹~` 提交于 2019-12-04 07:10:04
问题 I'm trying to build an app where someone can fill in their personal data like their name, telephone number, Email... For each field mentioned above, I created an EditText . Now my goal is to save the user's input using SharedPreferences so that he/she don't have to fill it up every time they reopen the app. The codes I've found take care of saving the data for one EditText only (Save entered text in editText via button). How can I achieve that on multiple EditText fields? This is my XML file

Edittext: Error solved then enable the send button in android

Deadly 提交于 2019-12-04 06:57:17
问题 i have five edittext fields which is checking the fields and restricts some data when entered wrong as shown below code but now if i enter wrong data in edittext then it will enter the information into database so i want to disable the button if there are errors in any edittext . The error might be in 1 to 5 edittext it has to disable the send button. It has to only enable the send button when there are no errors in the edittext fields public class MaINActivity extends Activity { String

setText doesn't set text to EditText

故事扮演 提交于 2019-12-04 06:44:18
I'm having a problem that I've never had before in almost three years of developing with Android... I want to take a picture and after the picture is taked, the EditText s of the activity become clear. What I'm doing is set the values of the EditText to Strings using getText().toString() to restore them after taking the picture. The strings are stored perfectly with the data, but when I use setText , it doesn't work... The strange thing is that setHint works! How can it be? Here's the code I'm using: @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { if

How to implement a simple Syntax highlighting method for edittext?

本秂侑毒 提交于 2019-12-04 06:05:21
I am making an app that involves coding and I need edittext to recognize if the word typed was 'something' then depending if it is registered to be colored, it will color the word. Here is what I want to do, when the user is typing and types 'function' I want it to automatically highlight. Same goes to any other 'function' word, '()', ' " ', and many other words the user types. You can accomplish this by using a TextWatcher like so: editText.addTextChangedListener(new TextWatcher() { final String FUNCTION = "function"; @Override public void beforeTextChanged(CharSequence s, int start, int

Getting a NumberFormatException from a numerical EditText field

与世无争的帅哥 提交于 2019-12-04 05:46:49
问题 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

Android EditText setError() doesn't work as expected

两盒软妹~` 提交于 2019-12-04 05:23:55
问题 I am having a problem with setError() on EditText . When an activity is opened, it checks if certain fields are empty and sets error message on them if true. However, the exclamation mark icon is only displayed in case I write some text in field and then delete it. If I lose focus on that field, the icon will disappear again. Both fields Naam and Telefonnumer have this validation. I use Android 2.2.2 SDK and the application is run on Nexus 7 with latest updates. I have Util class: public

Android: catching action for keyboard enter button being pressed

偶尔善良 提交于 2019-12-04 05:10:07
I am trying to respond to pressing the enter button on a standard system on screen soft keybord, in numeric mode. keyboard appears on the screen when myCustomEditText class is given focus. tried 2 approaches: overriding onKeyDown() : public boolean onKeyDown(int keyCode, KeyEvent event) { if (keyCode == KeyEvent.KEYCODE_ENTER) { //do sth.. return true; } return super.onKeyDown(keyCode, event); } setting listener setOnKeyListener : myCustomEditText.setOnKeyListener(new OnKeyListener() { public boolean onKey(View v, int keyCode, KeyEvent event) { if (keyCode == KeyEvent.KEYCODE_ENTER) {

EditText unable to change the text color

て烟熏妆下的殇ゞ 提交于 2019-12-04 05:01:32
问题 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