android-edittext

Android: Numeric key register backspace pressed

喜欢而已 提交于 2019-12-11 22:16:38
问题 I have an EditText which only accepts numeric numbers defined like this: <EditText android:id="@+id/routeInit_price" android:layout_height="wrap_content" android:layout_width="120dp" android:layout_gravity="center_horizontal" android:lines="1" android:inputType="numberDecimal"/> I am validating if there is a valid input like below to enable/disable a button. However, I doesn't receive an event on the backspace/delete button pressed event. How can I fix that? Because when the EditText is empty

EditText and using buttons to submit them

≯℡__Kan透↙ 提交于 2019-12-11 21:00:11
问题 So basically I would like this to allow the user to input text (their name). Then to click the submit button which will store that name into an array and erase the writing in the EditText (as well as make a counter for players). After they are done submitting players names I want them to be able to click the play button (titled done i believe) and continue to the next page with all the information being sent over. My problem currently is when i enter in a name and click submit it force closes

How to pass get text from userinput (edittext) and put into a textview in another activity?

一个人想着一个人 提交于 2019-12-11 19:43:06
问题 I would like to take user input entered in the EditTextField(in the EnterNewFile class) and put it into the TextField (in the NoteEdit class). Please help! Thanks! FYI- I use XML files for the layouts of these two classes. ***********EnterNewFile.class********* package com.example.note; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.util.Log; import android.view.View; import android.widget.Button; import android.widget.EditText; public

EditText is not showing virtual keyboard

允我心安 提交于 2019-12-11 19:27:18
问题 I have created a dynamic screen with editText in it..but after click it is not showing the virtual keyboard.I have added these following codes..but still ot worked. getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE); and this also dint worked InputMethodManager im = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE); im.showSoftInput(edittext, 0); my code is here... runOnUiThread(new Runnable() { public void run() { LinearLayout

What Makes My EditText Empty?

纵然是瞬间 提交于 2019-12-11 19:24:56
问题 I created the database. I used edittext to insert data to my database. There is a problem in my edittexts. When i used log to show the data in my edittexts but they are empty. I don't understand where the problem is. Please help me. Thanks in advance. Adding Data: public void AddData() { setContentView(R.layout.dbase2); EditText e1 = (EditText) findViewById(R.id.eText1); EditText e2 = (EditText) findViewById(R.id.eText2); EditText e3 = (EditText) findViewById(R.id.eText3); EditText e4 =

Incompatible types: android.widget.Edit Text and java.lang.String

只愿长相守 提交于 2019-12-11 19:06:27
问题 I have got this error on Android Studio IDE. It says Incompatible types; Required android.widget.EditText and Found java.lang.String @Override public void afterTextChanged(Editable s) { if (editabletext.length() == 8) { editabletext = editabletext.getText().toString().replaceAll("([0-9]{4})([0-9]{4})", "$1-$2") } } 回答1: editabletext is an EditText and replaceAll returns a String. What the compiler says is that you can't assign a String to an EditText . You could change your code this way: if

How to prevent auto scrolling of EditText when keyboard appears on Android?

女生的网名这么多〃 提交于 2019-12-11 18:15:57
问题 Even i put scrollview or not, when my edit text request focus and keyboard appears, my view automatically scrolled to top a little bit. It breaks my design. I have to prevent this. Could you please help me? 回答1: Addthis android:windowSoftInputMode="adjustPan" android:isScrollContainer="false" in the manifest file 回答2: Add this line in your Manifext.xml under your activity tag and make sure your activity must not use android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen" . android

Retrieving data from EditText in Android?

心不动则不痛 提交于 2019-12-11 18:07:51
问题 How do I work with whatever the user enters into an EditText, in Java? For just one example, maybe the user enters "I had a great time this weekend!" into an EditText (like a Facebook update or Tweet). I want to do something with "I had a great time this weekend!" so how do I use Java to affect it in the app???? 回答1: You can get a value back from an EditText with EditText editText = (EditText) findViewById(R.id.editText1); String value = editText.getText().toString(); I recommend .trim() 'ing

Retrieving Arabic text from editText in Android

混江龙づ霸主 提交于 2019-12-11 18:05:31
问题 I have an application in Android witch has an editText that takes Arabic text. Then based on this Arabic text i make a query in MySQL through php. The problem is that when i retrieve the Arabic text from the editText MySQL query returns null but when i write the Arabic text manually in the program (not retieving it from the editText) it works perfect and god. What is the problem any one can help me. Thanks. This is my php code <?php header("Content-type: text/html; charset=UTF-8"); $con

android EditText alphabet-only validation

廉价感情. 提交于 2019-12-11 17:44:57
问题 i wanted to validate a EditText and see if all of the letters are alphabet. it should be able to handle multiple EditText. i need a way to prevent user from entering anything other then alphabet. userTextInput=(EditText)findViewById(R.id.textInput); userTextInput.addTextChangedListener(this); public void afterTextChanged(Editable edit) { String textFromEditView = edit.toString(); //first method ArrayList[] ArrayList; //ArrayList [] = new ArrayList; for(int i=0; i<=textFromEditView.length(); i