Note that there are some explanatory texts on larger screens.

plurals
  1. PODisplay ResultSet in Table View
    primarykey
    data
    text
    <p>I really need help I have a ResultSet as a result of select query from MySQL DB. how can I display it in table layout?? I have setup a layout for tableview</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical"&gt; &lt;EditText android:id="@+id/myFilter" android:layout_width="match_parent" android:layout_height="wrap_content" android:ems="10" android:hint="@string/some_hint" /&gt; &lt;TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:padding="10dp" android:text="@string/some_text" android:textSize="20sp" /&gt; &lt;TableLayout android:id="@+id/producttablelayout" android:layout_width="match_parent" android:layout_height="wrap_content" android:dividerPadding="@dimen/activity_horizontal_margin" android:scrollbars="horizontal|vertical" android:showDividers="none|beginning|middle|end" &gt; &lt;TableRow android:id="@+id/tableRow1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:gravity="top|bottom|left|right" android:paddingTop="@dimen/activity_horizontal_margin" &gt; &lt;TextView android:id="@+id/ttt1" android:text="Column 1" android:textAppearance="?android:attr/textAppearanceLarge" /&gt; &lt;TextView android:id="@+id/ttt2" android:text="Column 12" android:textAppearance="?android:attr/textAppearanceLarge" /&gt; &lt;/TableRow&gt; &lt;/TableLayout&gt; &lt;/LinearLayout&gt; </code></pre> <p>I want to be able to add ResultSet data into it. Something like:</p> <pre><code> super.onCreate(savedInstanceState); String s = null; setContentView(R.layout.activity_list_all_products); // Show the Up button in the action bar. setupActionBar(); context333=this; TableLayout myTable = (TableLayout)findViewById(R.id.producttablelayout); try { connect2 = DriverManager.getConnection(LogonActivity.url, LogonActivity.user, LogonActivity.password); statement2 = connect2.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); preparedStatement2 = connect2.prepareStatement("select article_code,article_desc from products limit 4"); resultSet2=preparedStatement2.executeQuery(); resultSet2.beforeFirst(); while (resultSet2.next()) { how to add next record here to the table layout?? } </code></pre> <p>Please help</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.
    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