android-edittext

Android EditText setError() doesn't work as expected

你离开我真会死。 提交于 2019-12-02 04:13:00
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 class Util { private static String TAG = "Util Class"; public static boolean editTextIsEmpty(EditText

Fragment Intermediate(I):Getting input from edittext, set text in textview of a fragment

≯℡__Kan透↙ 提交于 2019-12-02 04:01:40
really in need of some advice, dont know what is wrong here. Context: 2 fragments with a Textview each and the main activity has 2 button and a edittext Aim: Type hello into the edittext box in the main activity and When click on the button for fragment 1, the textview will change to hello. Problem: Face a runtime error when enter hello into edittext and click on button 1. Logcat: E/AndroidRuntime(1291): FATAL EXCEPTION: main E/AndroidRuntime(1291): android.view.InflateException: Binary XML file line #29: Error inflating class fragment E/AndroidRuntime(1291): android.view.LayoutInflater

Get integer value from edittext

别来无恙 提交于 2019-12-02 03:30:02
When I try to run the code below, my program has stops. I want this code to get the value from edittext but it´s not working as I expected it. What am I doing wrong? public class MainActivity extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Button sum = (Button) findViewById(R.id.button1); Button cancel = (Button) findViewById(R.id.button2); final EditText from = (EditText) findViewById(R.id.editText1); final EditText upto = (EditText) findViewById(R.id.editText2); final EditText runsum =

Android Edit Text - Cursor stays at the starting position

孤者浪人 提交于 2019-12-02 03:15:53
问题 I am using an Edit Text in my project. The problem is that whenever I type anything into the text box, it shows up, but the cursor does not move from its starting position at all, regardless of how many characters I type. Also I am not able to move by clicking to any particular character in the text box. My xml file for containing the edit text is like this <EditText android:id="@+id/xEt" android:layout_width="fill_parent" android:layout_height="295dp" android:layout_alignParentLeft="true"

EditText saved the value after device rotation automatically

随声附和 提交于 2019-12-02 03:04:50
问题 I created a sample application in Android Studio to learn about the life cycle of an Android application. I know that orientation change completely restarts the activity (i.e. OnCreate method is called again). As far as I know, orientation change should have destroyed the context and shown a blank text after device rotation. But somehow without overriding onSaveInstanceState and onRestoreInstanceState methods it is saving the context. I don't have any fragments. It just the basic template

Get EditText value on different fragment

笑着哭i 提交于 2019-12-02 02:33:08
问题 I am trying to get some text from editTexts on different fragments. So what I do first is define my mPager and mPagerAdapter : a_Atenuacion Activity public class a_Atenuacion extends FragmentActivity{ private static final int NUM_PAGES = 3; /** * The pager widget, which handles animation and allows swiping horizontally to access previous * and next wizard steps. */ private ViewPager mPager; /** * The pager adapter, which provides the pages to the view pager widget. */ private PagerAdapter

Android EditText native selector

筅森魡賤 提交于 2019-12-02 02:18:25
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"/> <item android:state_window_focused="false" android:state_enabled="false" android:drawable="@android

Can two views both have focus in Android

限于喜欢 提交于 2019-12-02 02:01:11
问题 I have a EditText, and a popupWindown(which has a ListView in it), now i touch the EditText, the popupWindow shows. i need the situation: i can input something in SoftInput, and i also can click a child item in ListView which is the children of PopupWindow. Now, i can only input, or can only click listview , i can't do the both thing in Android 4.1, 4.2. But i can do both in Android 4.4, 5.0。 I tried in many ways, like popupWindo.setFocus(true), which only make the EditText lose the focus. So

Editable text view with spinner android

被刻印的时光 ゝ 提交于 2019-12-02 01:45:35
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? You can build your own view: public class ServerPreference extends DialogPreference { private String value; private EditText editText; private Spinner spinner; private final int server_list_id; ArrayList<String> servers; public

Set a consistent theme for all the editTexts in Android

。_饼干妹妹 提交于 2019-12-02 01:30:38
问题 I have finished making my app. Now, I want to reset all my editTexts to have the layout width as fill parent instead of wrap content. android:layout_width="fill_parent" while currently all my editTexts are android:layout_width="wrap_content" Is there any way i can do this in a style xml file, instead of individually in each layout? I currently have this as my styles.xml <style name="AppTheme" parent="android:Theme.Light"> <item name="android:fontFamily">Verdana</item> <item name="android