android-edittext

Android add edittext field on click of (+) button and remove by click of (-)

孤街浪徒 提交于 2019-12-06 22:11:30
I am creating a add contact activity. There will be only one edit text and a button (+), when click on button then another edit text should be added and previous button should change into (-). By this method i want to add and remove edit text fields. Some thing like this. I am doing like this but not able to achieve that i want. Any idea? public class TextField extends Activity { Context con; TableLayout table; TableRow tr[] = new TableRow[6]; EditText txt[] = new EditText[6]; //ImageView img[] = new ImageView[5]; Button img[]=new Button[6]; int count ; int lastDeletedIndex; int

EditText getText() returns empty string

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-06 21:39:16
问题 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)

Android Edit Text Cursor Doesn't Appear

依然范特西╮ 提交于 2019-12-06 20:06:40
问题 in my app I disabled the keyboard (I use now my custom keyboard) using this code: editText.setInputType(InputType.TYPE_NULL); Now, my problem is that the text cursor does not appear anymore in the edit text. What should I do? Any suggestion would be very appreciated. 回答1: There is an Issue opened in bug tracker Issue opened in bug tracker for this. One of the users suggests the approach which works on "most" devices. Briefly, all you have to do is call: editText.setRawInputType(InputType.TYPE

EditText on demand widget

主宰稳场 提交于 2019-12-06 19:18:27
I'd like to have a TextView display text, and when you click/longclick on it, a textbox should "show up" and allow editing of said text. When you're done editing (onkey enter i suppose) it should revert back to a textview with the updated text... I'm wondering if it's feasable to implement such a widget or should I hack a workaround? Tips and suggestions are very welcome. If you need further idea of what I mean, just go to your e.g. (windows) skype profile and see for yourself. EDIT: Clarification: I'm specifically asking for a widget or such which is a textview until clicked on, then

Android: How to clear an EditText by cross Button in the right side

守給你的承諾、 提交于 2019-12-06 17:28:57
问题 I have created an EditText for search, which contains on the left side a search icon and on the right side of icon: <EditText android:id="@+id/Search" android:layout_width="250dp" android:layout_height="wrap_content" android:drawableLeft="@android:drawable/ic_menu_search" android:drawableRight="@android:drawable/ic_delete" android:hint="Search Product .." > </EditText> I want to know how can I clear the content of EditText when I click the cross button. Thank you in advance. 回答1: An improved

Android Button needs two click for action

此生再无相见时 提交于 2019-12-06 17:02:47
问题 I have a form. 7 EditText in vertical layout. On screen in one moment can see only 3 EditText (form is big so I need to scroll up and down to fill all fileds). In bottom - Button. When I fill top EditText (or one of top, wich is invisible when I scrolled down to button), and focus (cursor) in this EditText, when I scrolled down and try to click Button once - nothing happens. when I click again - happens button action. When both EditText with focus and Button is visible - Button needs one

How to Set Id in EditText programmatically in Android

半城伤御伤魂 提交于 2019-12-06 16:48:07
I have this button on GridLayout called addnewTask. When you create this button, it will create an EditText. private GridLayout gridLayout; int rowIndex = 3; int colIndex = 1; int i=0; protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_set_task); gridLayout = (GridLayout) findViewById(R.id.taskLayout); } This function to create EditText when the button is clicked --> public void addView(View view) { i++; String tname = "task" + Integer.toString(i); EditText editText = new EditText(this); GridLayout.LayoutParams param = new

Moving focus from one EditText to another

懵懂的女人 提交于 2019-12-06 16:43:38
I designed a layout for a create account activity. when one EditText loses focus, I'm doing some checking on the input and if something is not right I want to regain the focus on that EditText . I already saw some questions about this, but its not working for me (or I'm doing something wrong). when I touch on a different EditText which triggers the requestFocus(), the focus remains on the current EditText and another focus icon is shown in the EditText which requeted the focus. help please here's my layout file: <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns

Email keyboard for edit text

試著忘記壹切 提交于 2019-12-06 16:36:33
问题 The following Code doesn't seem to work,I want the email keyboard with @ and .com to get displayed for the edit text. emailEditText.setInputType(InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS); 回答1: Add this to your layout: android:inputType="textEmailAddress" 回答2: Well I found the solution which is to use emailEditText.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS); 来源: https://stackoverflow.com/questions/11204120/email-keyboard-for-edit-text

EditText & TextChangeListener

帅比萌擦擦* 提交于 2019-12-06 16:10:36
问题 I need yours help. I have EditText field, which acts as search field for searching thought many items in the list. Now I'm use afterTextChanged(Editable s) method of TextWatcher, but it's not perfect for me. Some times after fast input and erase next search process involve not all text inputed by the user. The reason is in long search process and I can't make it shorter. In my case I need to know, wnen user ends his input at all, but afterTextChanged() handle every sign change. I will