android-edittext

How to use InputConnectionWrapper?

霸气de小男生 提交于 2019-12-03 12:31:32
I have an EditText . Now I want to get all changes made by the user to this EditText and work with them before manually inserting them into the EditText . I don't want the user to directly change the text in the EditText . This should only be done by my code (e.g. by using replace() or setText() ). I searched a bit and found an interesting class named InputConnectionWrapper . According to the javadoc it shall act as a proxy for a given InputConnection . So I subclassed it like this: private class EditTextInputConnection extends InputConnectionWrapper { public EditTextInputConnection

How to add TextView and EditText using default AlertDialog programmatically

為{幸葍}努か 提交于 2019-12-03 12:26:59
I've been trying to add two elements in a default AlertDialog but I can't seem to make it work. Here's my code: // START Dialog AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(this); TextView tv = new TextView(this); tv.setText(title); tv.setPadding(40, 40, 40, 40); tv.setGravity(Gravity.CENTER); tv.setTextSize(20); EditText et = new EditText(this); etStr = et.getText().toString(); alertDialogBuilder.setView(et); alertDialogBuilder.setTitle(title); alertDialogBuilder.setMessage("Input Student ID"); alertDialogBuilder.setCustomTitle(tv); if (isError) alertDialogBuilder.setIcon

How to get data from Edit Text in a RecyclerView?

随声附和 提交于 2019-12-03 12:25:44
问题 I have recyclerview with edit text. Each row has a edit text. I am entering values in the edit text manually and after i enter values, I want to get those values in each and every row. I want to get those values to the main activity. There may be 10 to 20 rows in the recyclerview. I want to get all values in those edit texts. This is my Adapter public class SelectItemAdapter extends RecyclerView.Adapter<SelectItemAdapter.ItemHolder> { private List<String> itemsName, itemsQty, itemsPCode,

Handle enter key in EditText across different devices

陌路散爱 提交于 2019-12-03 12:06:17
Right now I'm handling the enter key in my EditText fields using a an onEditorActionListener and looking at the Action ID for IME_NULL. It works fine for all my users except one. She has an Xperia Arc. TextView.OnEditorActionListener keyListener = new TextView.OnEditorActionListener(){ public boolean onEditorAction(TextView view, int actionId, KeyEvent event) { if(actionId == EditorInfo.IME_NULL){ if(((EditText)findViewById(view.getId())) == ((EditText)findViewById(R.id.etUser))){ ((EditText) findViewById(R.id.etPass)).requestFocus(); } if(((EditText)findViewById(view.getId())) == ((EditText

Android: Zooming EditText Android Issue in translation And Getting Touch event of childView when Placed outside parentView

↘锁芯ラ 提交于 2019-12-03 11:43:28
my question is related to android feature to zoom the parent consisting of multiple child view's. ZoomView->ParentView->[multiple childViews] I am working on a Demo project to Zoom the child View and to pan infinitely.Zooming works perfectly as needed. PROBLEM 1: But if there is a EditText in the view and i try to zoom on that then below issues are faced by me. on zooming in the text is blurred pointing on a text is working fine but translating through the text is translating very fast as its translation is multiplied by the scalingFactor Selecting the text is also having above issue. Try

Soft keyboard covers an EditText in a PopupWindow

别来无恙 提交于 2019-12-03 11:27:24
问题 I've thrown together a simple test project that displays a PopupWindow containing an EditText (on Android 2.2). When I tap the EditText, the soft keyboard is shown, as I would expect. However, the soft keyboard covers the EditText, and I cannot get the screen to pan to keep the EditText in view in the way I would have thought it should. My code: TestAdjustPanActivity.java: package com.example; import android.app.Activity; import android.graphics.drawable.BitmapDrawable; import android.os

Android 6 EditText.setError not working correctly

六眼飞鱼酱① 提交于 2019-12-03 11:08:37
I have upgraded to android 6 and seeing some strange things when trying to set validation for some editTexts. I am using android-saripaar for validation: @Email(messageResId = R.string.error_email) private EditText email; @Password(min = 6, scheme = Password.Scheme.ALPHA_NUMERIC_MIXED_CASE_SYMBOLS) private EditText password; @ConfirmPassword private EditText repassword; @NotEmpty(messageResId = R.string.error_name) private EditText firstname; @NotEmpty(messageResId = R.string.error_name) private EditText lastname; private Validator mValidator; For some reason the email, password, confirm

How to set Min text (Mandatory) and Max text in EditText

烈酒焚心 提交于 2019-12-03 11:04:06
In my EditText field, I want to give some min text as mandatory and max text as the limit, is there any way to achieve that? If one is to type text, the numeric count has to decrease. How would I do that? <EditText android:id="@+id/editText1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:layout_below="@+id/textView1" android:layout_marginTop="24dp" android:maxLength="175" android:ems="10" /> this is my adding activity.java @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState);

OnEditorActionListener not working

大憨熊 提交于 2019-12-03 11:03:53
I simply want to catch the event when the user press enter on an editText. I did not get the Toast message, not the "Enter pressed" and not the "Some key pressed!" either. What m i doing wrong? myEditText.setOnEditorActionListener(new OnEditorActionListener() { @Override public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { Toast.makeText(getApplicationContext(), "Some key pressed!", Toast.LENGTH_LONG).show(); if (event != null && (event.getKeyCode() == KeyEvent.KEYCODE_ENTER)) { Toast.makeText(getApplicationContext(), "Enter pressed", Toast.LENGTH_LONG).show(); return true

Android Edit text alignment

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-03 10:46:57
I am making a small app for a tablet, something like a display sign. I have a few text elements that are center aligned in the display sign. When I tap on it, it gets converted to editText. I want the edit text in such a way that the text in it is center aligned and content wrapped. But when i input something, editText expands both ways, keeping the text aligned to the center. I want to do the same thing with right aligned text elements (only difference is that the edit text would expand only towards the left). When i am trying to do this right now it expands towards the left.This is my code