Note that there are some explanatory texts on larger screens.

plurals
  1. PONo Multiple choice item seen in ListFagment
    text
    copied!<p>The below is the code for the Subclass of ListFragment.</p> <pre><code> @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); SQLiteDatabase allDatabase2 = new TaskDatabaseManager(getActivity()) .getWritableDatabase(); Cursor allDetail = allDatabase2.rawQuery("Select " + TaskDatabaseManager.KEY_ROWID + "," + TaskDatabaseManager.TASK_TIMES + "," + TaskDatabaseManager.TASK_DESCRIPTION + " from " + TaskDatabaseManager.DATABASE_TABLE + " where " + TaskDatabaseManager.TASK_DATE + "= '" + LaunchActivity.selectedDate + "'", null); String[] fromColumns = { TaskDatabaseManager.TASK_TIMES, TaskDatabaseManager.TASK_DESCRIPTION }; int[] toView = { R.id.Time, R.id.TaskDescription }; allDetail.moveToFirst(); if (allDetail != null) { setListAdapter(new SimpleCursorAdapter(getActivity(), R.layout.layout_for_cursor, allDetail, fromColumns, toView, 0)); } } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { return inflater .inflate(R.layout.fragment_layout, container, false); // return super.onCreateView(inflater, container, savedInstanceState); } </code></pre> <p>Now as u can see i have set the choiceMode as ListView.CHOICE_MODE_MULTIPLE on the Overriden onViewCreated() method.</p> <pre><code>@Override public void onViewCreated(View v, Bundle b) { super.onViewCreated(v, b); getListView().setChoiceMode(ListView.CHOICE_MODE_MULTIPLE); } } </code></pre> <p>but still nothing is like multiple choice is visible in the details.</p> <p>Below is the code for my fragment_layout.xml</p> <pre><code> &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/MainContentLayout1" android:layout_width="match_parent" android:layout_height="match_parent" &gt; &lt;ListView android:id="@id/android:list" android:layout_width="match_parent" android:layout_height="match_parent" android:drawSelectorOnTop="true" /&gt; &lt;/LinearLayout&gt; </code></pre> <p><strong>Edited.This is layout_for_cursor</strong></p> <pre><code> &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/layoutForDetails" android:layout_width="fill_parent" android:layout_height="fill_parent" &gt; &lt;TextView android:id="@+id/Time" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:layout_alignParentTop="true" android:layout_marginLeft="58dp" android:textAppearance="?android:attr/textAppearanceLarge" /&gt; &lt;TextView android:id="@+id/TaskDescription" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignLeft="@+id/Time" android:layout_below="@+id/Time" android:layout_marginTop="33dp" android:textAppearance="?android:attr/textAppearanceMedium" /&gt; &lt;/RelativeLayout&gt; </code></pre>
 

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