Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Mobile Development
  3. Android
  4. how to set Data from database to ListView

how to set Data from database to ListView

Scheduled Pinned Locked Moved Android
questiondatabasehelptutorial
1 Posts 1 Posters 3 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    mAzeem22
    wrote on last edited by
    #1

    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);

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups