Disable soft keyboard on NumberPicker

I’m trying to deactivate the soft keyboard when using a NumberPicker to enter numerical values (for aesthetic reasons). This is my layout-xml-code: <?xml version=”1.0″ encoding=”utf-8″?> <LinearLayout xmlns:android=”http://schemas.android.com/apk/res/android” android:layout_width=”match_parent” android:layout_height=”match_parent” android:orientation=”vertical” > <LinearLayout android:id=”@+id/linearLayout2″ android:layout_width=”wrap_content” android:layout_height=”wrap_content” android:layout_gravity=”center_horizontal” android:layout_marginBottom=”30dp” android:layout_marginTop=”30dp” > <NumberPicker android:id=”@+id/repetitionPicker” android:layout_width=”40dp” android:layout_height=”wrap_content” /> <TextView android:id=”@+id/textView1″ android:layout_width=”wrap_content” android:layout_height=”wrap_content” android:layout_gravity=”center_vertical” android:text=”@string/repetitions_short_divider” android:textAppearance=”?android:attr/textAppearanceMedium” /> <NumberPicker android:id=”@+id/weightPicker” android:layout_width=”40dp” … Read more

How to get hosting Activity from a view?

I have an Activity with 3 EditTexts and a custom view which acts a specialised keyboard to add information into the EditTexts. Currently I’m passing the Activity into the view so that I can get the currently focused edit text and update the contents from the custom keyboard. Is there a way of referencing the … Read more

The specified child already has a parent. You must call removeView() on the child’s parent first (Android)

I have to switch between two layouts frequently. The error is happening in the layout posted below. When my layout is called the first time, there doesn’t occur any error and everything’s fine. When I then call a different layout (a blank one) and afterwards call my layout a second time, it throws the following … Read more

Programmatically change input type of the EditText from PASSWORD to NORMAL & vice versa

In my application, I have an EditText whose default input type is set to android:inputType=”textPassword” by default. It has a CheckBox to its right, which is when checked, changes the input type of that EditText to NORMAL PLAIN TEXT. Code for that is password.setInputType(InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD); My problem is, when that CheckBox is unchecked it should again … Read more

How do I handle ImeOptions’ done button click?

I am having an EditText where I am setting the following property so that I can display the done button on the keyboard when user click on the EditText. editText.setImeOptions(EditorInfo.IME_ACTION_DONE); When user clicks the done button on the screen keyboard (finished typing) I want to change a RadioButton state. How can I track done button … Read more

How can I set the focus (and display the keyboard) on my EditText programmatically

I have a layout which contains some views like this: <LinearLayout> <TextView…> <TextView…> <ImageView …> <EditText…> <Button…> </linearLayout> How can I set the focus (display the keyboard) on my EditText programmatically? I’ve tried this and it works only when I launch my Activity normally, but when I launch it in a TabHost, it doesn’t work. … Read more