On 28-Dec-2010, at 3:07 PM, Sandeep Nyamati wrote:
> Hi Andres,
>
> public class EditActivity extends Activity {
>
> EditText editText;
> @Override
> public void onCreate(Bundle savedInstanceState) {
> super.onCreate(savedInstanceState);
> setContentView(R.layout.main);
> editText = (EditText)findViewById(R.id.edit1);
>
> final CheckBox checkbox = (CheckBox) findViewById(R.id.checkbox);
> checkbox.setOnClickListener(new OnClickListener() {
> public void onClick(View v) {
> if (((CheckBox) v).isChecked()) {
> editText.setEnabled(false);
> } else {
> editText.setFocusable(true);
> editText.setEnabled(true);
> editText.requestFocus();
> }
> }
> });
>
> }
> }
>
> main.xml
>
> <?xml version="1.0" encoding="utf-8"?>
> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
> android:orientation="vertical"
> android:layout_width="fill_parent"
> android:layout_height="fill_parent"
> >
> <EditText android:id="@+id/edit1"
> android:layout_width="fill_parent"
> android:layout_height="wrap_content"
> />
>
> <CheckBox android:id="@+id/checkbox"
> android:layout_width="wrap_content"
> android:layout_height="wrap_content"
> android:text="check it out" />
>
> </LinearLayout>
>
> Try it out.
>
> On 28-Dec-2010, at 12:40 AM, Andres Schmois wrote:
>
>> Does nothing... I believe this is a bug. You can try yourself if you'd like.
>>
>> Thanks,
>> Andres Schmois
>>
>> On 12/27/2010 7:59 AM, Sandeep N M wrote:
>>> Try editText.requestFocus()
>>>
>>> Regards,
>>> Sandeep
>>> On Dec 27, 11:15 am, Andrew<[email protected]> wrote:
>>>> No no, the method gets called. There might be a bug when adding
>>>> focusable again. I know for sure .setFocusable gets called because the
>>>> edittext becomes white again.
>>>>
>>>> On Dec 27, 1:08 am, praveena ankitha<[email protected]> wrote:
>>>>
>>>>> write the code in check box .setOnCheckedChangeListener(...) method then
>>>>> automatically that textbox is chaged according to check box
>>>>> On Mon, Dec 27, 2010 at 11:13 AM, Andrew<[email protected]> wrote:
>>>>>> if (isChecked) {
>>>>>> editText.setFocusable(false);
>>>>>> editText.setEnabled(false);
>>>>>> } else {
>>>>>> editText.setEnabled(true);
>>>>>> editText.setFocusable(true);
>>>>>> }
>>>>>> So this is called after a checkbox is clicked on. When it's checked
>>>>>> the textbox goes gray and it cannot gain focus. When it's unchecked
>>>>>> the textbox goes white again, but it still cannot gain focus. So the
>>>>>> problem here is that an edit text view cannot regain focus after being
>>>>>> re-focusable. isFocusable returns true. Is this a bug???? I've been
>>>>>> looking for an answer for quite a while.
>>>>>> --
>>>>>> You received this message because you are subscribed to the Google
>>>>>> Groups "Android Developers" group.
>>>>>> To post to this group, send email to [email protected]
>>>>>> To unsubscribe from this group, send email to
>>>>>> [email protected]<android-developers%2Bunsubs
>>>>>> [email protected]>
>>>>>> For more options, visit this group at
>>>>>> http://groups.google.com/group/android-developers?hl=en
>>>>> --
>>>>> Praveena Ankitha
>>>>
>>
>
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en