android-edittext

EditText in ListView is updated by onTextChanged when scrolling

爱⌒轻易说出口 提交于 2019-12-04 11:33:17
问题 I have been searching for an answer to this, but the solutions don't seem to work for me. I have a TextView and an EditText in a list item. I am trying to update the stored values for the EditTexts when the user edits them. @Override public View getView(int index, View convertView, ViewGroup parent) { ViewHolder holder = null; final int pos = index; if (convertView == null) { convertView = mInflater.inflate(R.layout.user_details_list_row, parent,false); holder = new ViewHolder(); holder

Is there any way to permanently hide soft keyboard but keep enabling focus for an EditText?

回眸只為那壹抹淺笑 提交于 2019-12-04 11:09:10
In my android app, I have 3 EditTexts in my one activity. I created my own number pad in the activity. Whenever i tap any EditText, soft keyboard comes up. I want to block that permanently for this activity but if user tap an EditText then it should be in focus. Like a cursor blinking. Any idea how can i do that? Thanks in advance. Hiding Keyboard Manually Here InputMethodManager mgr = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); YourEditText.setOnFocusChangeListener(new OnFocusChangeListener() { @Override public void onFocusChange(View v, boolean hasFocus) { // TODO

Android - How To retrieve EditText value from RecyclerView in MainActivity

淺唱寂寞╮ 提交于 2019-12-04 11:05:06
How can I retrieve the value from all EditTexts created by the RecyclerView in MainActivity? In my RecyclerView Adapter I'm extending my inner class: public class MyPersonalAdapter extends RecyclerView.Adapter<MyPersonalAdapter.MyPersonalViewHolder> I'm getting a reference to the EditText in that inner class: class MyPersonalViewHolder extends RecyclerView.ViewHolder { TextView numberTextView; EditText nameEditText; public MyPersonalViewHolder(View itemView) { super(itemView); numberTextView = (TextView) itemView.findViewById(R.id.tv_number); nameEditText = (EditText) itemView.findViewById(R

How to dynamically set layout parameters in Android?

纵然是瞬间 提交于 2019-12-04 10:42:19
问题 I have these text fields which I generated dynamically. But I can't seem to set layout parameters for them. Please tell me what I'm doing wrong. I'm able to generate the fields without layout parameters. However, If I use LayoutParams , it doesn't even get generated. Code: TableLayout table = (TableLayout) findViewById(R.id.TableLayout1); TableRow tr = new TableRow(this); LinearLayout.LayoutParams trparams = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout

requestFocus doesn't work properly for EditText

ぃ、小莉子 提交于 2019-12-04 10:40:26
问题 A lot of time was spent to solve the problem, and it looks easy, but I'm really tired and couldn't find the solution. I have an Activity, activity has 4 EditText components, 2 of them has popup menu (AlertDialog) which contain the list, next one - is disabled for edit, and last one - is editable, and should show the soft keyboard, when user is tapping on it. Also, my root LinearLayout has LinearLayout which contain inside RelativeLayout. The last one is need for AdvBanner. Last LinearLayout

Validation in EditText allow IP or web Url host

风流意气都作罢 提交于 2019-12-04 10:38:08
I am in need to give validation on my EditText such that it allows me to enter a valid ip address format ( ?.?.?.? ) ie example 132.0.25.225 or web url format ( www.?.? ) ie example www.example.com logic is that if user type any numeric value first then validation(IP) will do action else user must write "www" before any web String Note : it must perform onKeyListener() of EditText, i mean while user giving input In short - I am not going to check when user completes input and press OK button Any idea appreciated, Thanks. ip private static final String PATTERN = "^([01]?\\d\\d?|2[0-4]\\d|25[0-5

Android EditText: How to disable cursor move on touch?

坚强是说给别人听的谎言 提交于 2019-12-04 10:33:48
问题 I have EditText which displays something like ###-###. I want the user to be able to change this text only from the 1st position onward. That is user should not be able to touch a # in the middle and change it. How can I do this? Thanks a lot. Sorry, I was not precise in my question. I want to disable even tapping in the middle of the text. 回答1: Following code will force the curser to stay in last position if the user tries to move it with a tap on the edittext: edittext.setCursorVisible

Is it possible to create a custom floating text selection menu in Android versions pre Marshmallow?

☆樱花仙子☆ 提交于 2019-12-04 10:05:12
I'm looking to create a custom menu for text selection. I know it's possible to edit the behaviour of the action bar with setCustomSelectionActionModeCallback, but in my case I don't want that action bar to show at all, I want my own floating custom menu which I have already achieved. Only thing is that there is no way to not show the action bar menu after selecting the text in the TextView. The behaviour I need is not the standard cut/copy/paste, the actions I have implemented are for highlighting and saving the highlighted section of text to a database. I have done some tinkering and the

android edittext minmum and maximum value

走远了吗. 提交于 2019-12-04 09:59:31
I am in development of an android app.. actually i need to set a minimum and maximum value for an editext entry my minimum value is 18 and maximum is 65.I did the exact code of this package com.test; import android.text.InputFilter; import android.text.Spanned; public class InputFilterMinMax implements InputFilter { private int min, max; public InputFilterMinMax(int min, int max) { this.min = min; this.max = max; } public InputFilterMinMax(String min, String max) { this.min = Integer.parseInt(min); this.max = Integer.parseInt(max); } @Override public CharSequence filter(CharSequence source,

Detect delete button in soft keyboard

試著忘記壹切 提交于 2019-12-04 08:59:13
问题 I have two EditText (each only only accepts one character) and I want to handle both fields like I had only one. I'm using a TextWatcher to set the focus in the second one when the user writes a character in the first one, but I don't know how to do the opposite. If the user press the delete button in the second EditText (being this EditText empty) I want to move the focus to the first EditText and delete the character there. The problem is that TextWatcher doesn't work when the user tries to