vendredi 22 mai 2015

How to listview my data from database SQLite

ListView lv = (ListView) findViewById(R.id.lv);



    protected void onCreate(Bundle savedInstanceState) {
        // TODO Auto-generated method stub
        super.onCreate(savedInstanceState);
        setContentView(R.layout.view_activity);

//I fetched the data from my database

        DBase db = new DBase(this);
        db.open();
        String recs = db.getAllRecords();
        db.close();
        if (recs.isEmpty()) {
            Toast.makeText(this, "No records found.", Toast.LENGTH_SHORT)
                    .show();
        } else {

//I want to display in listview my data from sqlite database here.

        }
    }

Aucun commentaire:

Enregistrer un commentaire