Note that there are some explanatory texts on larger screens.

plurals
  1. POAndroid doesn't detect click on EditText
    primarykey
    data
    text
    <p>I am working on an Android tablet application with a little bit complex forms (layout has a ListView and the layout with the form included so I have to inflate EditText) . My idea is that if I click on a TextView where the date is shown the DataPicker would be shown in dialog. </p> <p>The problem is that click is not detected. There is no Logs.</p> <p>Java:</p> <pre><code> public static EditText datep; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.admissions_all); ActionBar actionBar = getActionBar(); actionBar.setDisplayHomeAsUpEnabled(true); View inf = LayoutInflater.from(getApplicationContext()).inflate(R.layout.admissions, null); datep = (EditText) inf.findViewById(R.id.date_value); datep.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { Log.i("Date", "You clicked me mate!"); showDatePickerDialog(v); } }); } public void showDatePickerDialog(View v) { DialogFragment newFragment = new DatePickerFragment(); newFragment.show(getFragmentManager(), "datePicker"); Log.i("Date", "I want to show datePicker"); } public static class DatePickerFragment extends DialogFragment implements DatePickerDialog.OnDateSetListener { @Override public Dialog onCreateDialog(Bundle savedInstanceState) { // Use the current date as the default date in the picker final Calendar c = Calendar.getInstance(); int year = c.get(Calendar.YEAR); int month = c.get(Calendar.MONTH); int day= c.get(Calendar.DAY_OF_MONTH); // Create a new instance of DatePickerDialog and return it return new DatePickerDialog(getActivity(), this, year, month, day); } public void onDateSet(DatePicker view, int year, int month, int day) { datep.setText(day + "." + month+ "." + year); } } </code></pre> <p>XML:</p> <pre><code>&lt;RelativeLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignLeft="@id/general" android:layout_alignRight="@id/general" android:layout_below="@+id/general" android:layout_centerHorizontal="true" android:layout_marginTop="30dp" &gt; &lt;TextView android:id="@+id/title" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:layout_alignParentTop="true" android:text="Data" android:textAppearance="?android:attr/textAppearanceLarge" /&gt; &lt;View android:id="@+id/line" android:layout_width="wrap_content" android:layout_height="1dp" android:layout_alignParentLeft="true" android:layout_alignParentRight="true" android:layout_below="@+id/title" android:background="#333333" /&gt; &lt;EditText android:id="@+id/date_value" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@+id/line" android:layout_marginLeft="5dp" android:layout_marginTop="5dp" android:layout_toRightOf="@+id/date_desc" android:ems="9" android:inputType="date" &gt; &lt;/EditText&gt; &lt;TextView android:id="@+id/date_desc" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignBaseline="@+id/date_value" android:layout_alignBottom="@+id/date_value" android:layout_alignParentLeft="true" android:text="Date:" android:textAppearance="?android:attr/textAppearanceMedium" /&gt; &lt;/RelativeLayout&gt; </code></pre> <p>I followed this: <a href="http://developer.android.com/guide/topics/ui/controls/pickers.html" rel="nofollow">http://developer.android.com/guide/topics/ui/controls/pickers.html</a></p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload