android-edittext

How to change the text of a running AlertDialog

扶醉桌前 提交于 2019-12-02 10:44:59
问题 How do you change the current string of a text on a AlertDialog after you click a button that selects a date from a CalendarPickerFragment. This the AlertDialog public class FragmentInicio extends Fragment{ private static String date; public void addDate(){ View view = (LayoutInflater.from(getActivity())).inflate(R.layout.alert_dialog,null); AlertDialog.Builder alertDialog = new AlertDialog.Builder(getActivity()); alertDialog.setView(view); final TextView date_Text = view.findViewById(R.id

EditText in a list aren't working the way they should

与世无争的帅哥 提交于 2019-12-02 09:45:13
I have a problem with EditText fields in a ListActivity . The code complies all right, but the functionality is strange, typing in the first field and hiding the keyboard after this the text appears in another editfield. Help me with my logical issue package com.example.helloandroid; import android.app.ListActivity; import android.content.Context; import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.BaseAdapter; import android.widget.EditText; import android.widget.TextView; public class AddComp extends

How to make modification Android Snackbar containing with LayoutInflater button and editText

﹥>﹥吖頭↗ 提交于 2019-12-02 09:40:13
My project now is how to make a Snackbar displayed at the bottom of the screen. The Snackbar contain with editText and three button for selection categories. I use LayoutInflater and follow these code for my script, and it's work. My problem now is, how to get response when user click the button ? Here my code @Override public void onClick(View v) { CoordinatorLayout linearLayout = (CoordinatorLayout)findViewById(R.id.coordinatorLayout); final Snackbar snackbar = Snackbar.make(linearLayout, "", Snackbar.LENGTH_INDEFINITE); Snackbar.SnackbarLayout layout = (Snackbar.SnackbarLayout) snackbar

Called From Wrong Thread Exception

戏子无情 提交于 2019-12-02 09:32:04
I am getting an exception here when I try to bring another view to the front. It happens in the last method of my BoardView class where it says if(lives == 0). Can anybody see where I should be calling this bringToFront method from?? public class BoardView extends SurfaceView implements SurfaceHolder.Callback{ Context mContext; // thread initialization private BoardThread thread; Thread timer; // box variables Bitmap box = (BitmapFactory.decodeResource (getResources(), R.drawable.box)); private int box_x = 140; private int box_y = 378; private int boxWidth = box.getWidth(); private int

Is it possible to make an EditText in android 2.x that looks like an EditText from Android 4?

安稳与你 提交于 2019-12-02 09:08:00
问题 Is it possible to make an EditText in android 2.x that looks like an EditText from Android 4? I mean blue backlight with flanged edges below. 回答1: Yes there is a library called holoeverywhere, you'll get all 4.2 components in 2.1+: https://github.com/ChristopheVersieux/HoloEverywhere 回答2: If you don't want to use an external library you can use the following code: add the below code to res\values\styles.xml <style name="HoloEditText"> <item name="android:background">@drawable/edit_text_holo

Looping through editTexts to check values

落花浮王杯 提交于 2019-12-02 08:39:29
I have one layout with 100 blank EditTexts, all named based on their row / column IDs (e.g. box0101, box0102 etc.). I then have another layout with 100 TextViews in exactly the same layout with one letter in each, named using the same convention (answerbox0101, answerbox0102 etc.) I want to write a loop that checks box0101 against answerbox0101, and so on until either one of the boxes does not match up, or it gets to 100 and all the boxes match. I am fine with writing the logic of the loop, my issue is that i need the looping parameter to be part of the name of the EditText! How can I overcome

How to add a character in EditText after user starts typing

蹲街弑〆低调 提交于 2019-12-02 08:33:21
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.addTextChangedListener(new TextWatcher() { @Override public void onTextChanged(CharSequence s, int start, int before,

Change text from other activity

≡放荡痞女 提交于 2019-12-02 08:12:58
I want to change the contents of an EditText on another Activity with a button. Both activities extend from the same parent. How can I do this? prolink007 i recently started learning about java events and listeners. I believe my SO question may help you. Here is the link to my question . Basically what you can do is set up an event for when they press the button and then have a listener and have the listener trigger the change. Take a look at my question for more detail. If you take a look at the accepted answer you will see a great example i made. 来源: https://stackoverflow.com/questions

Android Capitalize characters not working in phone

做~自己de王妃 提交于 2019-12-02 08:03:15
in my app, I want to allow the user to enter only upper case letters. So I used capitalize property. This is one part of code <EditText android:id="@+id/et5" android:layout_width="140dp" android:layout_height="wrap_content" android:layout_x="127dp" android:layout_y="219dp" android:maxLength="25" android:ems="10" android:singleLine="true" android:capitalize="characters" android:text="" /> In some cases I also tried this android:inputType="textCapCharacters" It works fine in emulator, But it is not working in phone. In phone, it shows lower case letters. What is the mistake here and how to

Not able to fill details in EditText Of ListView in android

情到浓时终转凉″ 提交于 2019-12-02 08:02:11
I had created an app with custom listview. My listview contains an edittext field. But I can't fill edit text with value.I am new to android so it is hard to find error to me. Here is my code: public class MainActivity extends Activity { private ListView myList; private MyAdapter myAdapter; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); myList = (ListView) findViewById(R.id.MyList); myList.setItemsCanFocus(true); myAdapter = new MyAdapter(); myList