Note that there are some explanatory texts on larger screens.

plurals
  1. PORetrieving all of data from sqlite
    primarykey
    data
    text
    <p>I will show data which is in sqlite db to spinner. Showing is easy but I can't retrieve the datas that I added to db.Here is my codes;</p> <pre><code>public class MainActivity extends Activity { private Spinner spinner; private SQLiteDBOlustur sqlnesne; private SQLiteDatabase db; private ContentValues cv; private Cursor cursor; private ArrayList&lt;String&gt; arr; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); spinner = (Spinner) findViewById(R.id.spinnerIller); arr = new ArrayList&lt;String&gt;(); veriEkle(); db = sqlnesne.getReadableDatabase(); cursor = db.rawQuery("select * from iller", null); if (cursor.moveToFirst()) { do { arr.add(cursor.getString(cursor.getColumnIndex("adsoyad"))); } while (cursor.moveToPrevious()); } for (int i = 0; i &lt; arr.size(); i++) { System.out.println(arr.get(i)); } } </code></pre> <p>Only I can see the last added data.So how to get all of data in my sqlite db?</p> <p>Also these are adding data method.</p> <pre><code> private void veriEkle() { sqlnesne = new SQLiteDBOlustur(getApplicationContext()); db = sqlnesne.getWritableDatabase(); cv = new ContentValues(); cv.put("il_adi", "Yalova"); cv.put("il_adi", "Karabük"); cv.put("il_adi", "Kilis"); cv.put("il_adi", "Osmaniye"); cv.put("il_adi", "Düzce"); try { db.insert("iller", null, cv); Toast.makeText(getApplicationContext(), "Veriler eklendi!", Toast.LENGTH_SHORT).show(); } catch (Exception e) { e.printStackTrace(); } } </code></pre>
    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