How to add distinct items into spinner from DB in android
<p>i need to upload unique data from DB into spinner list in android.Ex.In my DB i have 4 records as "Jan","Feb","Mar","Jan".i need to upload those data in to spinner by distinct.i.e.only jan,feb,mar.
How could i do this?</p>

<p>My code...
 //...</p>

<pre><code> Spinner spin = (Spinner) findViewById(R.id.spin);

 AdapterCountries = new ArrayAdapter&lt;CharSequence&gt;(this,
                                 android.R.layout.simple_spinner_item);
 AdapterCountries.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);

 spin.setAdapter(AdapterCountries);
 spin.setOnItemSelectedListener(new OnItemSelectedListener());

 db1.open();
 // long id;

 Cursor cursor = db1.getAllTitles1();
 while (cursor.moveToNext()){
   results=cursor.getString(2);
   AdapterCountries.add(results);
 }
 db1.close();
</code></pre>

<p>In My DBAdapter class..</p>

<pre><code>public Cursor getAllTitles1(){

 return db.query(DATABASE_TABLE1, new String[] {

            KEY_ROWID,DISHNAME,CATEGORY,DESCRIPTION},null,null,null,null,null);
}
</code></pre>
