How to play .mp3 file in a Android Emulator?

To play .mp3 file from sdcard of the emulator follow the steps.

  1. Copy .mp3 file from your hard drive location. e.g. d:\songs\song1.mp3
  2. Open any new eclipse project. File -> New -> Android Project.
  3. In Eclipse Click on the icon “Opens the Android SDK and AVD Manger” from the toolbar.
  4. Create New AVD, by choosing, select target greater than 1.6.
  5. Upon successful creation start the AVD.
  6. In Eclipse, Goto DDMS perspective. Window -> Open Perspective -> DDMS.
  7. In DDMS Perspective, select the device (AVD) which is currently running from the Devices Panel.
  8. On the right panel from “File Explorer”, Select SDCARD folder.
  9. On the tool bar select the button “Push a file on to the device”.
  10. Select the .mp3 file from the location.
  11. Goto Java Perspective. Window-> Open Perspective -> JAVA.
  12. Write the following Code.

String PATH_TO_FILE = “/sdcard/a.mp3”;
MediaPlayer mp1 = new MediaPlayer();
try

       {
mp1.setDataSource(PATH_TO_FILE);
mp1.prepare();
mp1.start();
}
       catch (IllegalArgumentException e)
      {
// TODO Auto-generated catch block
e.printStackTrace();
}
      catch (IllegalStateException e)
      {
// TODO Auto-generated catch block
e.printStackTrace();
}
      catch (IOException e)
      {
// TODO Auto-generated catch block
e.printStackTrace();
}
Run the project…..!!!!

Mobile Computing [Assignment :- 02]

Assignment: – 02

Date: – 10/08/2011

Submission Date: – 25/08/2011

  • Write a brief note on OHA.
  • List and explain in detail advantages and features of android platform.
  • Explain underlying architecture of android platform. (Draw the figure)
  • Write a brief note on following

AVD
DDMS
ADB

  • List and explain 3 methods of Log class. How it is useful for debugging application explain with example.
  • Explain following in detail. (Ref book : 01 & Text book)

Content providers
Activity
Intent
Service
Broadcast receivers
Widgets
Notifications

  • What is activity stack? How android platform manages various activities?
  • Explain various states of activities of application. Draw the fig. that demonstrates state change of activity. (Ref book:01 pg no. 79 & fig 3.7)
  • Explain lifecycle of an activity with example.
  • Write a brief note on “androidmanifest.xml” file. Explain purpose and importance of this file for android project.
  • Explain following with respect to “androidmanifest.xml” file (Tags used & example) (Ref book : 01 & Text book)

Application’s Identity (versioncode, app icon, app name etc.)
Application’s system requirements (used-sdk , sdk versions..)
Application platform requirements (uses-configuration supported input methods, uses-feature device features, supports-screens screen sizes, external libraries)
Registering permission for application’s requirements (uses-permission e.g. camera)

  • Explain registering application’s activities to androidmanifest.xml file? How to make any activity as main activity, explain with example.
  • Explain resources with respect to android.
  • Explain handling following resources with suitable example

Accessing string, string-array resources
Accessing Boolean, Integer resources
Accessing Color resources
Accessing Dimension resources

Mobile Computing [Assignment: – 01]

Assignment: – 01

Date: – 15/07/2011

Submission Date: – 25/07/2011

Explore Android market & related applications (Minimum 3 Applications)

 

Write a report containing the following details for each android application which must be from different domains. There must be one page for each application.

Format of report should be :

Filename : <Enrollment no>.doc

No. of Pages : at least 3 pages.

Content:

1)    Name of Application.

2)    Domain.

3)    Source URL.

4)    Description.

5)    Application Screen Shots (At least 3 screen shot containing major functionality).

6)    Comments. (Facilities that can be improved, limitation of current application).

7)    Similar applications.