Note that there are some explanatory texts on larger screens.

plurals
  1. POGridView with an array of data in every cell
    primarykey
    data
    text
    <p>I have a <code>GridView</code> for students and think like I fill every cell with one student name, and in every <code>GridCell</code> that student has name he also got all marks that he got for whole year in the same cell. So in every cell I have like:</p> <p>a <code>gridview</code></p> <pre><code> ------------------------------- | student 1 | student 2 | | | | | a listview | | | or scrollview | a listview | | ---------- | ----------- | | english A | english B | | math A | math A | | history A | history E | ----------------------------- </code></pre> <p>and current xml for this</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/senaryolar_grid" android:layout_width="166dp" android:layout_height="210dp" android:padding="3dp" android:background="@color/white"&gt; &lt;RelativeLayout android:layout_width="166dp" android:layout_height="32dp" android:background="@drawable/senaryobaslik" android:id="@+id/senaryo_baslik"&gt; &lt;TextView android:layout_width="100dp" android:layout_height="wrap_content" android:id="@+id/senaryo_baslik_tv" android:textColor="@color/white" android:layout_marginLeft="4dp" android:textStyle="bold" /&gt; &lt;ImageView android:id="@+id/senaryo_baslik_iv" android:src="@drawable/arti" android:layout_width="22dp" android:layout_height="18dp" android:layout_toRightOf="@id/senaryo_baslik_tv"/&gt; &lt;/RelativeLayout&gt; &lt;ScrollView android:layout_height="50dp" android:layout_width="fill_parent" android:id="@+id/senaryo_scrollview" android:layout_below="@id/senaryo_baslik"&gt; &lt;LinearLayout android:layout_height="wrap_content" android:layout_width="fill_parent" android:id="@+id/senaryo_scroll_ll"&gt; &lt;/LinearLayout&gt; &lt;/ScrollView&gt; &lt;/RelativeLayout&gt; </code></pre> <p>so my problem is I try to generate these <code>listviews</code> or <code>scrollview</code> (tried both) inside my <code>getView()</code> function of my <code>gridview</code> since I didnt know that <code>getView()</code> function called a looot of times while <code>gridview</code> is generated by <code>getview()</code> function so I tried to put my generater inside a <code>getView()</code> function but it didnt work and I got <code>outofmemoryexception</code>, and my question is: "Where should I call my <code>listview adapter</code>?" to create it dynamicly inside my <code>gridview</code> according to students id if I can not call it in <code>getview()</code>? </p> <p>My current <code>gridviewadapter</code>: (I just put this <code>gridviewadapter</code>'s <code>getview()</code> function and the xml code above to show you what I try to do, but be aware that this is not the correct way to do what I am trying to do)</p> <pre><code>public View getView(int position, View grid, ViewGroup parent) { if(grid == null){ grid=layoutInflator.inflate(R.layout.senaryolar_grid, null); } ArrayList&lt;ControlItem&gt; senario_devices = new ArrayList&lt;ControlItem&gt;(); // here think like senario_id is student_id int senario_id = samples_senario.get(position).getSenarioId(); // here think like getSenarioDevices is getStudentMarks senario_devices = dbhelpit.getSenarioDevices(senario_id); int senario_device_size = senario_devices.size(); TextView tv_senario; ImageView iv_senario; // I tried scrollview too since I thought listview adapters created outof memory exception but off course didnt work since its not the main problem ScrollView lv_senario; tv_senario = (TextView) grid.findViewById(R.id.senaryo_baslik_tv); iv_senario = (ImageView) grid.findViewById(R.id.senaryo_baslik_iv); lv_senario = (ScrollView) grid.findViewById(R.id.senaryo_scrollview); tv_senario.setText(samples_senario.get(position).getSenarioName()); int i = 0; LinearLayout ll = (LinearLayout) grid.findViewById(R.id.senaryo_scroll_ll); while(i &lt; senario_device_size){ View temp = layoutInflator.inflate(R.layout.senaryolar_listview, null); TextView tv; ImageView iv; RelativeLayout rl; iv = (ImageView) temp.findViewById(R.id.senaryo_list_baslik_iv); rl = (RelativeLayout) temp.findViewById(R.id.senaryolar_list); tv = (TextView) temp.findViewById(R.id.senaryo_list_text_tv); tv.setText(senario_devices.get(position).getDeviceName()); ll.addView(rl); i++; } return grid; } </code></pre> <p>So if you had a grid view adapter and you want to create a <code>listViewAdapter</code> in every grid cell where whould you call those <code>listViewAdapters</code> while you can't call in <code>getView()</code> function, it doesn't have to be a <code>listview</code>, it can be only a pure while that echoes the results like an <code>array</code>, I hope the question is clear. Thank you!</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.
    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