Tag: android-edittext

Change Line Color of EditText – Android

Can I change the line color on EditText. When is active it has some greenish color. Is it possible to change only the color of line when is active, and how can I do this…?

Android execute function after pressing “Enter” for EditText

I have been following the official Android tutorials and somehow am having a problem with this very simple example to execute a function after pressing “Enter” for an EditText. I understand what I’m supposed to do and seem to have everything setup properly, but Eclipse is complaining with this line: edittext.setOnKeyListener(new OnKeyListener() { It underlines […]

Is it possible that when click edittext it will show dialog message?

I want to click a edittext and show dialog date so I try mDateDisplay = (EditText) findViewById(R.id.dateDisplay); mDateDisplay.setOnFocusChangeListener(new View.OnFocusChangeListener() { @Override public void onFocusChange(View v, boolean hasFocus) { if (hasFocus) { showDialog(DATE_DIALOG_ID); } } }); The dialog will show if mDateDisplay is a button but I want to use edittext what should I do?

Android EditText in AlertDialog seems too wide

It seems like the EditText in the image below is too wide. I assume that I have misused the SDK in some way and until convinced otherwise I am not looking for a way to specify some number of margin/padding pixels on the sides of the EditText. This one looks more appropriate. Here’s my code […]

Android: Hiding the keyboard in an overridden “Done” keypress of EditText

I have used a bit of Android code to override the “Done” button in my EditText field: myEditField.setOnEditorActionListener(new TextView.OnEditorActionListener() { @Override public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { if (actionId == EditorInfo.IME_ACTION_DONE) { mySubroutine(); return true; } return false; } }); Activating the field calls up the keyboard, and pressing “Done” evaluates mySubroutine() […]

EditText in PopupWindow not showing keyboard even if setFocusable(true)

I can’t seem to get this work. I already set popWindow focusable as to what I read on other forums but still no luck. xml <?xml version=”1.0″ encoding=”utf-8″?> <LinearLayout xmlns:android=”http://schemas.android.com/apk/res/android” android:layout_width=”wrap_content” android:layout_height=”fill_parent” android:adjustViewBounds=”true” android:background=”@drawable/popbg” android:orientation=”vertical” > <Button android:id=”@+id/cancel” android:layout_width=”wrap_content” android:layout_height=”wrap_content” android:layout_gravity=”right” android:layout_marginRight=”10dp” android:layout_marginTop=”30dp” android:background=”@drawable/zcancel” /> <TextView android:id=”@+id/textView3″ android:layout_width=”wrap_content” android:layout_height=”wrap_content” android:layout_marginTop=”10dp” android:layout_marginLeft=”10dp” android:text=”SSID” android:textAppearance=”?android:attr/textAppearanceMedium” /> <EditText […]

Converting String to Double in Android

Trying to get double values from an EditText and manipulate them before passing them to another Intent. Not using primitive data type so I can use toString methods. Problem is when I include the protein=Double.valueOf(p).doubleValue(); style commands, the program force closes immediately without leaving any info in the logcat.If I comment them out and set […]

How to exclude special characters from android keypad for EditText

Hi I want to show only numbers and characters on the keypad for EditText in android, I did try to add the attribute android:inputType = text|number but it did not work. Please help me with any other better suggestion. thanks in advance.

Android: Remove Enter Key from softkeyboard

In my login form when user clicks on an EditText and presses the enter key, this inserts a new line, therefore increasing the EditText’s size. Next moment, it returns to its previous place and prints a dot in the password field (which is the next field). I want to remove this enter key from the […]

border for EditText?

This question already has an answer here: Is there an easy way to add a border to the top and bottom of an Android View? 18 answers

Android Babe is a Google Android Fan, All about Android Phones, Android Wear, Android Dev and Android Games Apps and so on.