Tag: android-edittext

Enable and disable Button according to the text in EditText in Android

I want to disable by Button if the words in the EditText is less than 3 words, and if the words in the EditText are more than 3 words then I want to enable it so that it can get Clicked. Can anyone help me here?

make EditText lose focus on clicking a button

I have two EditText fields in my activity and a done button. I want both the EditText fields to loose focus (that is the cursor should not not be displayed on either of them) when the user presses the button. I am using the following code: final Button saveButton = (Button) findViewById(R.id.saveButton); saveButton.setOnClickListener(saveButtonListener); private OnClickListener […]

String.format uses comma instead of point

My app is working on many devices without problems so far. But now I got my new Galaxy Tab with Android 3.2 where it crashes all the time. I found out that the problem was a float in an EditText. I am using myEditText.setText(String.format(“%.1f”, fMyFloat)); to put the float in the EditText. But somehow the […]

Value in edittext don't show until it get focus. Android

I’m building an app that get its layout based on external data. The layout is split into different blocks depending on the indata. These blocks are displayed with the help of a viewflipper. In each block there is, for the time being, one or more “textview” and “edittext”. On the first page of the flipper […]

copying and pasting image in Edittext

I am on the project RichTextEditor and completed almost all functionality. I can insert image and can save the file with image and also getting the image and all styles while opening the file again.I am stuck at one point ie. when copying all the content of the Edittext, while pasting except Image all things […]

Android EditText AutoFocus to next EditText when at maxlength

I have a username and a password XML segment <EditText android:id=”@+id/username” android:hint=”@string/username_hint” android:layout_width=”match_parent” android:maxLength=”9″ android:nextFocusDown=”@+id/pswd” android:layout_height=”wrap_content”> </EditText> <EditText android:inputType=”textPassword” android:hint=”@string/password_hint” android:id=”@+id/pswd” android:layout_width=”match_parent” android:layout_height=”wrap_content”> </EditText> I want when the username field reaches the 9th character for the cursor focus to automatically jump to the password field I was looking at Focus next textview automatically and was […]

Change the color of the cursor of an EditText in Android 3.0

I have to have an EditText in my application with a white background. I did this in my theme.xml file <style name=”myEditText” parent=”@android:style/Widget.EditText”> <item name=”android:background”>#ffffffff</item> <item name=”android:textColor”>#ff000000</item> </style> The problem now is that the cursor is still white and therefore not visible. I did some googling and found this question here on StackOverflow: Set EditText […]

ListView Scrolls to Top when EditText Grows

I have a Listview with EditTexts in every cell. Whenever I add text to the point that the EditText grows 1 line, the ListView scrolls to the top (and usually removes the EditText from view by doing so). I found a few questions about this but they only seem to have “hacks” as answers and […]

Way to hide softkeypad provided not effecting the features of the edittext in android

I have hidden soft keypad because I have custom keypad on the app. When the edittext is clicked, soft keypad shouldn’t pop up. So, I have tried so many ways from the sources, but nothing worked except the editText.setFocusable(false); . But now the problem is edittext is not getting highlighted when I clicked it and […]

How to add margin between EditText and Soft Keyboard?

I want to add 10dp margin between EditText and Soft Keyboard. Here is my XML: <RelativeLayout android:id=”@+id/BottomLayout” android:layout_width=”fill_parent” android:layout_height=”wrap_content” android:layout_alignParentBottom=”true” android:layout_alignParentLeft=”true” android:background=”@drawable/bottom_glass” > <EditText android:id=”@+id/message” android:layout_width=”200dp” android:layout_height=”wrap_content” android:layout_centerHorizontal=”true” android:layout_centerVertical=”true” android:background=”@drawable/grey” android:ems=”10″ android:layout_marginBottom=”10dp” android:hint=”Enter Message” android:textColor=”#ffffff” > </EditText> <ImageButton android:id=”@+id/sendMessageButton” android:layout_width=”wrap_content” android:layout_height=”wrap_content” android:layout_centerVertical=”true” android:layout_marginLeft=”20dp” android:layout_toRightOf=”@+id/message” android:background=”@android:color/transparent” android:src=”@drawable/sendselector” /> <ImageButton android:id=”@+id/imageButton2″ android:layout_width=”wrap_content” android:layout_height=”wrap_content” android:layout_centerVertical=”true” android:layout_marginRight=”20dp” android:layout_toLeftOf=”@+id/message” android:background=”@android:color/transparent” […]

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