how to add another column in another spinner of same or other table in android studio

how to add second column value of same or other table in another spinner from sqlite database using button click in android studio

    retrievebtn.setOnClickListener(arg0 -> {

        // TODO Auto-generated method stub
        nos.clear();
        names.clear();

        //OPEN
        db.openDB();

           //RETRIEVE
           Cursor c = db.getAllValues();

        c.moveToFirst();
        while(!c.isAfterLast())
        {
            String no = c.getString(0);
            nos.add(no);
            String name = c.getString(1);
            names.add(name);
            c.moveToNext();
        }

               //CLOSE
               c.close();
               db.close();

               //SET IT TO SPINNER
               sp1.setAdapter(adapter);
               sp2.setAdapter(adapter);


    });


Comments

Popular posts from this blog

I get wrong characters when retreiving the message body of an email using TIdIMAP4.UIDRetrieveTextPeek2()

How to drop the all the 1's in a correlation matrix

Today Walkin 14th-Sept