android-edittext

Getting Edittext values

怎甘沉沦 提交于 2019-12-02 22:50:01
问题 In my application Two edit boxes are there,when clicking appropriate Editbox it will show An listview(which is another intent.From that user have to select 1 input,i am assigning these value to the textbox.Myproblem is when i set value for 1 editbox and clicking another textbox to get values the 1st textbox value is not there. My Code is: Screen with edittext box: public void onCreate(Bundle savedInstanceState) { final String fromunit=getIntent().getStringExtra("Fromunit"); final String

Saving EditText and retrieve it automatically

旧时模样 提交于 2019-12-02 22:34:33
问题 hi I'm trying to save the EditText widget values in the internal memory of the phone/tablet so that they can be retrieved automatically by the app when it closes or the activity stops. All off this will work using a save button.(The values of the widget are inputed by the user). 回答1: You should use the shared preference ,shared preference is used to store the data in locally app whenever need you can access it . use this link https://www.journaldev.com/9412/android-shared-preferences-example

How to show the numeric keypad

廉价感情. 提交于 2019-12-02 22:30:36
I read several other posts and using input.setInputType(TYPE_NUMBER_FLAG_DECIMAL); does open the keyboard but its not the numeric keyboard Is there a trick to this? Anju give android:inputType="number" inside your xml file Edit: "Number" does not work, changed to "number" (lowercase N) a) in xml android:numeric="decimal" b) in code EditText editView = new EditText(this); editView.setKeyListener(new DigitsKeyListener()); lordhong In your xml, you have to do this: android:inputType="Number" In your code, do: editText.requestFocus(); Then: InputMethodManager imm = (InputMethodManager

Creating EditText Dynamically in Android

独自空忆成欢 提交于 2019-12-02 22:26:37
I am working on a application where I have to create multiple EditText and Spinner dynamically. So I started looking for the solution as I don't have permission to use Invisible property in XML file. I searched a lot and got a very few examples only on stackoverflow . I follow them and created this program. **MainActivity.java code** public class MainActivity extends Activity { RelativeLayout containerLayout; static int totalEditTexts = 0; Button button; Context context; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout

EditText on Dialog returns no text

五迷三道 提交于 2019-12-02 21:54:35
问题 I am so tired on finding the mistake. I didn't find any mistake but I am getting no text from editText. please Look at following Code: activity_pwd.xml <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/layout_root" android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical" android:padding="10dp" > <TextView android:id="@+id/textView1" android:layout_width="wrap_content"

How to show an text editing box “over” the screen?

跟風遠走 提交于 2019-12-02 20:46:59
I have an application that has a primary layout of portrait (it is fixed as portrait), and there is one place to type in text. I would like to launch like a popup window in landscape orientation with the background image fogged out. I know there is a Popup Widget, but any ideas for rotating the text edit box would be great. Rotating it into a portrait view (text box only) when the keyboard is slid out would also work, as would showing a new screen with the text box on keyboard slide. Reto Meier The easiest solution to your problem is to display your EditText within a separate dialog themed

How to add a character in EditText after user starts typing

蹲街弑〆低调 提交于 2019-12-02 20:27:56
问题 I have an editText where a user inputs a phone number, but right when they click their first number, I want a '+' to appear in the beginning of the text. I have this code but the '+' is constantly there. I only want it to appear when a user inputs a number, how would I fix this? final EditText editText = findViewById(R.id.register_edit_phone); final String prefix = "+"; editText.setText(prefix); Selection.setSelection(editText.getText(), editText.getText().length()); editText

Android : Typeface is changed when i apply password Type on EditText

萝らか妹 提交于 2019-12-02 20:00:28
I use FloatLabel library ( https://github.com/weddingparty/AndroidFloatLabel ) to add a little animation when user begin to write something in an EditText Android. My problem is that the typeface seems to be changed when i apply the password type to my EditText. I would like to keep the same typeface as normal. (see picture 1) But when i add the following line to apply password type, the typeface of hint seems to be changed ! pass.getEditText().setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD); The following might solve it for you. pass.setTypeface(user

How do a simple calculator in Android? How to do it using Buttons and single edit text?

落爺英雄遲暮 提交于 2019-12-02 19:51:02
问题 I am learning Android so I want to keep things simple. I have to add two numbers and display the result in a single editbox. To add with the second number you have store the first number in a variable. Then later add using this variable with the second number in the edit text. If you look at the xml and Java Code below you will have a better idea. Thanks in advance. <?xml version="1.0" encoding="utf-8" ?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android

ImageSpan on EditText (smileys). With SwiftKey Keyboard doesnt work

扶醉桌前 提交于 2019-12-02 19:47:31
I am doing a simple chat application and i want to show smileys on edittext while writing the message. I have this to identify wich characters will be subsituted by an Image throught an ImageSpan (this is called only when an smileys character is inserted on EditText): for (index = start; index < start+num_chars; index++) { if (index + 1 > editable.length()) continue; if(emoticons.containsKey(editable.subSequence(index, index + 1).toString())){ int length=1; Drawable drawable = context.getResources().getDrawable(emoticons.get(editable.subSequence(index, index + 1).toString())); Bitmap bitmap =