android-edittext

Android - How to take an EditText (numbers) then convert it to an integer to use it for math?

大城市里の小女人 提交于 2019-12-05 05:51:26
I am wondering how to take an EditText area that the user can enter a number in, then make it an integer so it can be used in the program for adding, subtracting, dividing, etc. Basicaly I need the test the enter to be able to be used in a calculator which will be within the code and then it needs to be put into a TextView or string so the final answer can be seen by the user. More info: I have three EditText areas and the user has to fill in all three then press "equals" and it will tell them the answer, all the math and such needs to be in the code so the user just enters information and

Setting EditText imeOptions to actionNext has no effect when using digits

不羁的心 提交于 2019-12-05 04:40:24
Here my edittext:- <com.os.fastlap.util.customclass.EditTextPlayRegular android:id="@+id/full_name_et" style="@style/Edittext_white_13sp" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginTop="@dimen/_5sdp" android:background="#00ffffff" android:digits="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" android:imeOptions="actionNext" android:inputType="text" android:maxLength="20" android:maxLines="1" android:nextFocusDown="@+id/last_name_et" android:textCursorDrawable="@null" /> When I remove digit in edittext it work fine but with digit

How to set multiline,firstletter caps and disable suggestions on edittext

 ̄綄美尐妖づ 提交于 2019-12-05 04:14:04
I have an edittext for reply to email. i want to give three properties for edittext like Multiline, First character caps and disable word suggestions. I gave like this in xml... android:inputType="textCapSentences|textVisiblePassword" I tried in code also... etMessage.setInputType(InputType.TYPE_TEXT_FLAG_MULTI_LINE|InputType.TYPE_TEXT_FLAG_CAP_SENTENCES); I am not able to give multiline....how can i achieve this thanks I found solution for this problem Just set the following parameters in xml file.. android:inputType="textCapSentences|textVisiblePassword" These are for setting first letter of

Lollipop EditBox styling

独自空忆成欢 提交于 2019-12-05 04:08:31
I currently have this one: Is it possible to remove black stroke and have only highlighted? Does it violate any Google guideline about material design It is totally an android lollipop bug. It happens to the framework and AppCompat version of the EditText and will be fixed in a future release. See here: https://code.google.com/p/android/issues/detail?id=80180 来源: https://stackoverflow.com/questions/27123278/lollipop-editbox-styling

How to remove Android auto-suggest underlining in EditText?

痞子三分冷 提交于 2019-12-05 03:52:14
I'm using an EditText to write some text. Android's auto-suggest underlines the word, until we hit space. Now, if I enter the word without the space, the resulting text has an underline. It's because I use Html.toHtml(view.getText()). Now, there are a few answers I'll be expecting such as disabling auto-suggestion or using view.getText().toString(), but I need them both. I need the auto-suggestion feature as well as the formatting of the text. An example which solves this problem is the Gmail app. You can write whatever you want in the EditText box and it sends the email without the words

EditText getText() returns empty string

时间秒杀一切 提交于 2019-12-05 03:44:25
I have an activity with a button, when the user clicks on the button, an AlertDialog appear with 2 EditText where you put email and password to login. When I try to get the text from the EditText i always get only empty strings. The layout login_alert is the layout of the AlertDialog. Here the code: View view = getLayoutInflater().inflate(R.layout.login_alert, null, false); String email = ((EditText) view.findViewById(R.id.emailEditText)).getText().toString(); String password = ((EditText) view.findViewById(R.id.passwordEditText)).getText().toString(); System.out.println("DEBUG: "+email+", "

How to create an interface to get info from a Fragment to an Android Activity?

*爱你&永不变心* 提交于 2019-12-05 03:32:48
问题 Over the past days I've desperately been trying to build an android app with a simple fragment (which I use twice). I want to pass the contents of the fragments' EditText-boxes to a new activity. I just can't figure out how to get those contents from the fragments. What I have so far is this: I've got my edit_text_fragment.xml : <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout

Clickable Button (or any View) inside EditText in android

走远了吗. 提交于 2019-12-05 01:50:09
I want to have a Button or a clickable View in my EditText so that I can perform some action on click of it. I was able to put a drawable inside my EditText thanks to Marcosbeirigo for this answer. But, now I want to make it clickable so that I can perform some action on it. I know this is possible as HTC uses buttons inside EditText in their stock sms app as shown in the following image- In my case, the button will be positioned anywhere, can be in the center also. But the main thing is how can I put a button in EditText? papaiatis Use RelativeLayout. The Send and Attach buttons are simple

String.format uses comma instead of point

核能气质少年 提交于 2019-12-05 01:43:23
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 float on my 3.2 Galaxy Tab is generated with a comma instead of a point. When I read the EditText back the app crashes of course, telling me that this is no valid float because of the comma... What is going wrong here? Convert float to string.. From the documentation of String.format :

Android - Limit only one decimal point enter into a EditText

自作多情 提交于 2019-12-05 01:34:13
问题 I need help to only allow one decimal point to be entered into a EditText view. An example: I don't want 123.45.2 or 123..452 to be allowed. Once one decimal point is entered, no more are allowed. 回答1: Play around with this however you like it. myEditText.setKeyListener(DigitsKeyListener.getInstance(true,true)); Returns a DigitsKeyListener that accepts the digits 0 through 9, plus the minus sign (only at the beginning) and/or decimal point (only one per field) if specified. 回答2: You can set