Jump to content

PhCyber Tunnel Available!

Get it on Playstore
Download Now!

Ad Space For Rent

Get Your Product up here and let our users see them first when they visit our Forum. We have thousands of page views everyday!
More Info
Info
  • Welcome to PhCyber
  • Explore and Enjoy Browsing!
  • Lots of useful topics
  • Stay active and receive prizes
SuperVegita1

Mp3 Java Android Code

Recommended Posts

package com.example.audiomediaplayer1;  

  

import android.media.MediaPlayer;  

import android.net.Uri;  

import android.os.Bundle;  

import android.app.Activity;  

import android.view.Menu;  

import android.widget.MediaController;  

import android.widget.VideoView;  

  

public class MainActivity extends Activity {  

  

    @Override  

    protected void onCreate(Bundle savedInstanceState) {  

        super.onCreate(savedInstanceState);  

        setContentView(R.layout.activity_main);  

          

        MediaPlayer mp=new MediaPlayer();  

        try{  

            mp.setDataSource("/sdcard/Music/maine.mp3");//Write your location here  

            mp.prepare();  

            mp.start();  

              

        }catch(Exception e){e.printStackTrace();}  

          

    }  

  

    @Override  

    public boolean onCreateOptionsMenu(Menu menu) {  

        // Inflate the menu; this adds items to the action bar if it is present.  

        getMenuInflater().inflate(R.menu.activity_main, menu);  

        return true;  

    }  

  

}  

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...