Note that there are some explanatory texts on larger screens.

plurals
  1. POArranging Sqlite data in tabular form
    primarykey
    data
    text
    <p>I want to arrange my sqlite data in a tabular format. Right now, I am retrieving the data to a textview. But it does not arrange itself under the column name, which looks confusing. I want it to be displayed atleast under the right column name. I have tried adding multiple spaces between the multiple getString() while retrieving the data, but doesnt seem to help.!</p> <p>Can anyone help?? Thanks already.</p> <p>heres the code</p> <pre><code>public String getData() { // TODO Auto-generated method stub String [] columns = new String[]{KEY_ROW_ID, KEY_KM, KEY_FUEL_QTY, KEY_FUEL_PRICE, KEY_TOTAL_COST, KEY_MILEAGE, KEY_DATE,KEY_TANK_FULL}; fuelCursor = ourDatabase.query(FUEL_DATABASE_TABLE, columns, null, null, null, null, null); String resultSQL= ""; while(fuelCursor.moveToNext()) { resultSQL = resultSQL + fuelCursor.getString(0) + " " + fuelCursor.getString(1) + " " + fuelCursor.getString(2) +" "+ fuelCursor.getString(3) + " " + fuelCursor.getString(4) + " " + fuelCursor.getString(5) + " " + fuelCursor.getString(6) + " " + fuelCursor.getString(7) + "\n "; } return resultSQL; } </code></pre> <p>DIsplaying the data in textview:-</p> <pre><code> TextView tv=(TextView)findViewById(R.id.txtGetFuelInfo); StoredInfo info = new StoredInfo(this); Expense fe2= new Expense(); info.open(); String fuelData= info.getData(); info.close(); tv.setText(fuelData); </code></pre> <p>heres what it looks like</p> <p><img src="https://i.stack.imgur.com/iisUQ.jpg" alt="enter image description here"></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