1/3

Android Assignment

Using ListViews

Please conduct the following tasks alone. For implementation details you can refer to the lecture slides or the Android developer website. Please do not hesitate to ask me or the tutor if you have any questions. Under „Tip“ you can find some hints for the task. The „Checklist“ specifies what should happen when your implementation is correct.

2/3

Tasks

  1. Show internal Music on your Device in a ListView
  2. Show songs on your SDCard
3/3

1. Show internal Music on your Device in a ListView

Create a new app project. The app should contain one Activity that shows the content of your internal MediaStore database. The result should look similar to this:

40%

You should display at least the DISPLAY_NAME property of the file.

Tip

Let your Activity inherit from ListActivity and use an ArrayAdapter to fill the contents of your list.

Checklist
When the app opens, it shows a list of music files (at least the DISPLAY_NAME).

2. Show Songs on your SDCard

Next upload some music files (e.g. mp3) to your device’s or emulator’s SDCard and show the contents in your ListView. Please display at least following information: 1. The database ID of the file 1. The artist name 1. The song title 1. The duration in ms

Search for example for free mp3 song on the internet. If the applications crashes, what could be the reason for this and what is the solution? The result should look like this:

40%

Tip

To upload mp3 files to the SDCard of the emulator you can simply drag and drop files on your virtual device to upload them. To display the contents create a layout with four TextViews to contain the data and in your Activity use a SimpleCursorAdapter class to display the content. Be sure to have the right permissions to read from the external storage. If you build your app for an API level greater than 22, make sure you request the permissions in the activity. If you build it for API level 22 or lower, make sure your emulator also runs 22 or lower otherwise your app may crash due to missing permissions.

Checklist
When the app starts the music contents on the SDCard is displayed in a list.