how to set Data from database to ListView
-
i have developed an Call recording application. it works absolutely right. i managed to show all recorded audio files to listView and managed to play these files from listView. i Have created a database to show the Caller number into listView. the database is working right and it Inserting and Selecting the data from database. know i want to show the database data into ListView. How can i do this plz help. thanks. i'm uploading the code for you to understand. protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); listView = (ListView) findViewById(R.id.mylist); mp = new MediaPlayer(); // database getData = new CallerDatabase(MainActivity.this); getData.open(); receivedData = getData.retrieveData(); getData.close(); Toast.makeText(this, ""+receivedData, Toast.LENGTH_SHORT).show(); FileDataPathForArrayList(); } private void FileDataPathForArrayList() { // this will show the recorded files into ListVIew myList = new ArrayList(); File files = new File(MEDIA_PATH); File list[] = files.listFiles(); for (int i = 0; i < list.length; i++) { myList.add(list[i].getName()); } know how can i show the database data in this ArrayAdapter? adapter = new ArrayAdapter(this, R.layout.rowlayout, R.id.label, myList); listView.setAdapter(adapter);