Anyone can help me to debug where I m going wrong. Test Code may get from:
https://drive.google.com/file/d/0Bz1lc03pNQm6Qkw3bE93dWxjdXc/view?usp=sharing
Scenario, I have 3 activities
Main, Splash and menu. First I call Splash activity for 5 seconds after 5 seconds I call menu activity its not working from menu I want to call Main activity. If I skip Menu activity than its working fine.
Splash Activity
public class Splash extends Activity{
MediaPlayer ourSong;
#Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.splash);
ourSong = MediaPlayer.create(Splash.this, R.raw.dj);
ourSong.start();
Thread timer = new Thread()
{
public void run()
{
try
{
sleep(5000);
}
catch (InterruptedException e)
{
e.printStackTrace();
}
finally
{
Intent start = new Intent("com.example.test.menu");
startActivity(start);
}
}
};
timer.start();
}
#Override
protected void onPause() {
// TODO Auto-generated method stub
super.onPause();
ourSong.release();
finish();
}
}
Menu Activity
public class menu extends ListActivity{
String classes[] = {"MainActivity", "example1", "example1", "example1", "example1"};
#Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setListAdapter(new ArrayAdapter<String>(menu.this, android.R.layout.simple_list_item_1, classes));
}
#Override
protected void onListItemClick(ListView l, View v, int position, long id) {
// TODO Auto-generated method stub
super.onListItemClick(l, v, position, id);
String cheese = classes[position];
try
{
Class ourclass = Class.forName("com.example.test."+cheese);
Intent ourIntent = new Intent(menu.this, ourclass);
startActivity(ourIntent);
}
catch(ClassNotFoundException e)
{
e.printStackTrace();
}
}
}
Main Activity
public class MainActivity extends Activity {
int counter;
Button add, subtruct;
TextView textarea;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
counter = 0 ;
add = (Button)findViewById(R.id.button1);
subtruct = (Button)findViewById(R.id.button2);
textarea = (TextView)findViewById(R.id.textView1);
add.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {
// TODO Auto-generated method stub
counter++;
textarea.setText("Your total is"+counter);
}
});
subtruct.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {
// TODO Auto-generated method stub
counter--;
textarea.setText("Your total is"+counter);
}
});
}
}
Your code:
Thread timer = new Thread()
{
public void run()
{
try
{
sleep(5000);
}
catch (InterruptedException e)
{
e.printStackTrace();
}
finally
{
Intent start = new Intent("com.example.test.menu");
startActivity(start);
}
}
};
timer.start();
Right code:
Thread timer = new Thread()
{
public void run()
{
try
{
sleep(5000);
}
catch (InterruptedException e)
{
e.printStackTrace();
}
finally
{
Intent start = new Intent(Splash.this, menu.class);
startActivity(start);
}
}
};
timer.start();
Tip: Don't use lowerCase for Class Names
Related
I have change code to below and my purpose is to set a button
when I click the timer run,how to change the code below? thanks
new code below
I have change code to below and my purpose is to set a button
when I click the timer run,how to change the code below? thanks
new code below
public class MainActivity extends Activity {
/** Called when the activity is first created. */
Handler aHandler;
TextView aTextView;
Button aButton;
EditText aEditText;
Handler aHandler01;
TextView aTextView01;
Button aButton01;
EditText aEditText01;
Boolean checker=false;
int count = 11;
int count01 = 11;
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.activity_main);
aEditText = (EditText)findViewById(R.id.editText01);
aTextView = (TextView)findViewById(R.id.TextView01);
aEditText01 = (EditText)findViewById(R.id.editText02);
aTextView01 = (TextView)findViewById(R.id.TextView02);
aButton=(Button)findViewById(R.id.button01);
aButton01=(Button)findViewById(R.id.button02);
//第一個計時器
aButton.setOnClickListener(new Button.OnClickListener(){
#Override
public void onClick(View v){ if(!aEditText.getText().toString().equalsIgnoreCase(""))
{count=Integer.parseInt(aEditText.getText().toString());}
aHandler = new Handler();
if(checker==false){
aHandler.post(runnable);
checker=true;
}
}
});
//第二個計時器
aButton01.setOnClickListener(new Button.OnClickListener() {
#Override
public void onClick(View v) {
if (!aEditText01.getText().toString().equalsIgnoreCase("")) {
count01 = Integer.parseInt(aEditText01.getText().toString());
}
aHandler01 = new Handler();
aHandler01.post(runnable01);
}
});
}
//第一個計時器
final Runnable runnable = new Runnable() {
public void run() { // TODO Auto-generated method stub
if (count> 0) {
aTextView.setText(Integer.toString(count-1));
count--;
aHandler.postDelayed(runnable, 1000);
}else{
aTextView.setText("boom");
}
}
};
//第二個計時器
final Runnable runnable01 = new Runnable() {
public void run() { // TODO Auto-generated method stub
if (count01> 0) {
aTextView01.setText(Integer.toString(count01-1));
count01--;
aHandler01.postDelayed(runnable01, 1000);
}else{
aTextView01.setText("boom");
}
}
};
#Override
protected void onPause() { // TODO Auto-generated method stub
super.onPause();
if (aHandler != null) {
aHandler.removeCallbacks(runnable);
}
}
}
try this
private Handler handler = new Handler();
Boolean checker=false;
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.activity_main);
aEditText = (EditText)findViewById(R.id.editText01);
aTextView = (TextView)findViewById(R.id.TextView01);
aButton=(Button)findViewById(R.id.button01);
aButton.setOnClickListener(new Button.OnClickListener(){
#Override
public void onClick(View v){ if(!aEditText.getText().toString().equalsIgnoreCase(""))
{count=Integer.parseInt(aEditText.getText().toString());}
if(!checker){
checker=true;
handler.post(runnable);//to start timer
}
}
});
}
final Runnable runnable = new Runnable() {
public void run() {
// TODO Auto-generated method stub
if(checker)
{
checker=false;
return;
}
if (count> 0) {
aTextView.setText(""+Integer.toString(count-1));
count--;
aHandler.postDelayed(runnable, 1000);
}else{
aTextView.setText("boom");
}
}
};
as you are assigning the value to 'count' variable in OnCreate from editText when editText is empty, it is returning null string which then you are parsing for int value which returns NumberFormatException
try to do it as follows
if (!aEditText.getText().toString().equalsIgnoreCase(""))
{
count = Integer.parseInt(aEditText.getText().toString());
}
OR you can assign a value to 'count' from editText on any button's click or using TextChangedListener(TextWatcher) to monitor and get text from edittext at run time.
allVehiclesSpinner.setOnItemSelectedListener(new OnItemSelectedListener() {
#Override
public void onItemSelected(AdapterView<?> arg0, View arg1,
int position, long arg3) {
String item=allVehiclesSpinner.getItemAtPosition(position).toString();
if(!item.equalsIgnoreCase("Select")){
position=0;
vdetails.vehicleNo = item;
dbhHelper.opendatabase();
vdetails=dbhHelper.getVehicleId(item);
dbhHelper.close();
getLiveTrackingsAsyncTask livetask=new getLiveTrackingsAsyncTask();
livetask.execute();
}
}
#Override
public void onNothingSelected(AdapterView<?> arg0) {
// TODO Auto-generated method stub
}
});
public class getLiveTrackingsAsyncTask extends AsyncTask<String, Void, String> {
private ProgressDialog Dialog;
#Override
protected void onPreExecute() {
Dialog = new ProgressDialog(VTS_LiveTracking.this);
Dialog.setMessage(VTS_LiveTracking.this.getResources().getString(
R.string.loading));
Dialog.setCanceledOnTouchOutside(false);
Dialog.show();
Dialog.setContentView(R.layout.progress);
super.onPreExecute();
}
#Override
protected String doInBackground(String... params) {
String result="";
Log.d(WebServiceHelper.TAG, "AsyncTask>>>>>>>>>>>");
if(isInternetPresent){
try {
Log.d(WebServiceHelper.TAG, "AsyncTask CHeck Internet>>>>>>>>>>>");
Log.d(WebServiceHelper.TAG, "VehicleId CHeck Internet>>>>>>>>>>>"+vdetails.vehicleId);
vd=WebServiceHelper.getLiveTrackingDetails(ClientCode, SecretCode, vdetails.vehicleId);
//vd=WebServiceHelper.getLiveTrackingDetails(ClientCode, SecretCode, "2");
Log.d(WebServiceHelper.TAG, "VD>>>>>>>>"+vd.length);
for(int i=0;i<vd.length;i++){
Log.d(WebServiceHelper.TAG, "LiveTrackingElements1>>>>>>>>>>>>>>"+vd[i].deviceMobNo);
Log.d(WebServiceHelper.TAG, "LiveTrackingElements2>>>>>>>>>>>>>>"+vd[i].driverName);
vdetails.latitude=vd[i].latitude;
vdetails.longitude=vd[i].longitude;
Log.d(WebServiceHelper.TAG, "vdetails.latitudeLiveTrackingElements1>>>>>>>>>>>>>>"+vdetails.latitude);
Log.d(WebServiceHelper.TAG, "vdetails.longitudeLiveTrackingElements2>>>>>>>>>>>>>>"+vdetails.longitude);
}
} catch (ClientProtocolException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (JSONException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
result="Success";
}else{
result="Failure";
}
return result;
}
#Override
protected void onPostExecute(String result) {
if(result.contentEquals("Success")){
Log.d(WebServiceHelper.TAG, "AsyncTaskonPostExecute>>>>>>>>>>>");
Log.d(WebServiceHelper.TAG, "statuslogin>>>>>>>>>>>"+vdetails.status_login);
if(vdetails.status_login.equals("success")){
String lat=vdetails.latitude;
String lon=vdetails.longitude;
latitude=Double.parseDouble(vdetails.latitude);
longitude=Double.parseDouble(vdetails.longitude);
Log.d(WebServiceHelper.TAG, "latitude>>>>"+vdetails.latitude);
Log.d(WebServiceHelper.TAG,"longitude>>>>"+vdetails.longitude);
latlng=new LatLng(latitude, longitude);
Marker m=map.addMarker(new MarkerOptions().position(latlng));
map.animateCamera(CameraUpdateFactory.newLatLngZoom(latlng, 15.0f));
map.setOnMarkerClickListener(new OnMarkerClickListener() {
#Override
public boolean onMarkerClick(Marker marker) {
final Dialog dialog = new Dialog(VTS_LiveTracking.this);
dialog.setContentView(R.layout.custom_dialog);
dialog.setTitle("Report");
TextView driver, speed,latitude,longitude,last_updated_time,gps_status,
driver_mobile_no,vehicle_idle_status,ac_status,device_mobile_no,engine_status;
driver = (TextView)dialog.findViewById(R.id.drivernametxt);
speed=(TextView)dialog.findViewById(R.id.speedvaluetxt);
latitude=(TextView)dialog.findViewById(R.id.latitudetxt);
longitude=(TextView)dialog.findViewById(R.id.longitudetxt);
last_updated_time=(TextView)dialog.findViewById(R.id.last_updated_timetxt);
gps_status=(TextView)dialog.findViewById(R.id.gps_statustxt);
driver_mobile_no=(TextView)dialog.findViewById(R.id.driver_mobile_notxt);
vehicle_idle_status=(TextView)dialog.findViewById(R.id.vehicle_idle_statustxt);
ac_status=(TextView)dialog. findViewById(R.id.ac_statustxt);
device_mobile_no=(TextView)dialog.findViewById(R.id.device_mobile_notxt);
engine_status=(TextView)dialog.findViewById(R.id.engine_statustxt);
driver.setText(vdetails.driverName);
speed.setText(vdetails.vehicleSpeed);
latitude.setText(vdetails.latitude);
longitude.setText(vdetails.longitude);
last_updated_time.setText(vdetails.lastUpdatedDateTime);
gps_status.setText(vdetails.gpsStatus);
driver_mobile_no.setText(vdetails.driverMobNo);
vehicle_idle_status.setText(vdetails.vehicleIdleStatus);
ac_status.setText(vdetails.acStatus);
device_mobile_no.setText(vdetails.deviceMobNo);
engine_status.setText(vdetails.engineStatus);
dialog.show();
Button cancel=(Button) dialog.findViewById(R.id.okbtn);
cancel.setOnClickListener(new OnClickListener() {
#Override
public void onClick(View v) {
dialog.dismiss();
}
});
return false;
}
});
}else{
Toast.makeText(getApplicationContext(), vdetails.failReason, Toast.LENGTH_LONG).show();
}
}else if(result.contentEquals("Failure")){
Toast.makeText(getApplicationContext(), "Error in Login", Toast.LENGTH_LONG).show();
}
super.onPostExecute(result);
Dialog.dismiss();
Dialog=null;
}
}
}
Hi,
For my app,It is very necessary to display the location of a vehicle at a particular location.The location of the vehicle is given by the json webservices.Also the vehicle is moving and location is updated by the webservice.But according to my code the vehicle is not moving.How can I implement the movement of vehicle in my app?How can I implement the location change using timer?Is there any other methods to implement this?
Please help me
Here is my code
Use Timer..
mytimer = new Timer();
final TimerTask mytask = new TimerTask() {
public void run() {
//your code here
}
});
mytimer.scheduleAtFixedRate(mytask, int delay, int time);
Class To Start Service
allVehiclesSpinner.setOnItemSelectedListener(new OnItemSelectedListener() {
#Override
public void onItemSelected(AdapterView<?> arg0, View arg1,
int position, long arg3) {
String item=allVehiclesSpinner.getItemAtPosition(position).toString();
if(!item.equalsIgnoreCase("Select")){
position=0;
vdetails.vehicleNo = item;
dbhHelper.opendatabase();
vdetails=dbhHelper.getVehicleId(item);
dbhHelper.close();
Intent intent = new Intent(A.this,
Service_A.class);
startService(intent);
}
}
#Override
public void onNothingSelected(AdapterView<?> arg0) {
// TODO Auto-generated method stub
}
});
USE SERVICE TO UPDATE WEBSERVICE AFTER 1 SEC
Service_ A extend service
{
private Handler handler = new Handler();
#Override
public void run() {
// TODO Auto-generated method stub
handler.postDelayed(Service_ A.this,1000);
}
//do you code
}
Try to use thread to invoke async task every second use below code to replace
getLiveTrackingsAsyncTask livetask=new getLiveTrackingsAsyncTask();
livetask.execute();
Thread thread = new Thread(new Runnable() {
#Override
public void run() {
try {
Thread.sleep(1 * 1000);
new getLiveTrackingsAsyncTask.execute();
} catch (InterruptedException e) {
e.printStackTrace();
}
}
});
thread.start();
hi i have a menu activity that contains 4 buttons when i press button one the second
activity is open and.i added a back button in second activity to come back to activity
one(menu)how would it perform through code can any one help
private ListView lv;
public static ArrayList<String> your_array_list = new ArrayList<String>();
#Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.listview);
lv = (ListView) findViewById(R.id.listView1);
}
#Override
protected void onDestroy() {
// TODO Auto-generated method stub
super.onDestroy();
}
#Override
protected void onPause() {
// TODO Auto-generated method stub
super.onPause();
}
#Override
protected void onResume() {
// TODO Auto-generated method stub
super.onResume();
}
#Override
protected void onStart() {
// TODO Auto-generated method stub
super.onStart();
ArrayAdapter<String> arrayAdapter = new ArrayAdapter<String>(this,
android.R.layout.simple_list_item_1, your_array_list );
lv.setAdapter(arrayAdapter);
try {
DisplayM.main();
} catch (Exception e) {
e.printStackTrace();
}
// if (ViewClass.theEnd)
// your_array_list.add(ViewClass.methods);
int lst = 0;
for(int i=0; i<lst; i++)
{
}
}
#Override
protected void onStop() {
// TODO Auto-generated method stub
super.onStop();
}
this is my listview activity
Use below code in your back button
backButton.setOnClickListener(new OnClickListener() {
#Override
public void onClick(View v) {
// TODO Auto-generated method stub
YourActivity.this.finish();
}
});
Write below code on your activity :-
#Override
public void onBackPressed()
{
// TODO Auto-generated method stub
super.onBackPressed();
}
or
#Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK && event.getRepeatCount() == 0) {
finish();
return true;
}
return super.onKeyDown(keyCode, event);
}
or
#Override
public void onBackPressed()
{
// TODO Auto-generated method stub
// if u want to go specific activity then use this code
Intent intent = new Intent(this, YourMainActivity.class);
startActivity(intent);
finish();
}
In your second Activity on your Back Button onClick simply finish() the current (second/third ...) activity. This is what the default back button also does
in pause button you have to just call finish() method and then after finishing current activity it return to parent activity
At first my splash screen works perfectly, however later I tried to put in a code which would destroy the activity splash. I did this by putting the onPause method into the end of the protected void.
This is the splash screen before putting in the method
'package com.shipment.emulatorfix;
'import android.app.Activity;
'import android.content.Intent;
'import android.media.MediaPlayer;
'import android.os.Bundle;
'public class Splash extends Activity{
#Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.splash);
Thread timer = new Thread(){
public void run(){
try{
sleep(5000);
} catch(InterruptedException e){
e.printStackTrace();
}finally{
Intent openMain = new Intent("android.intent.action.TESTINGEMULATORACTIVITY");
startActivity(openMain);
}
}
};
timer.start();
}
'}
this is the after code
'package com.shipment.emulatorfix;
'import android.app.Activity;
'import android.content.Intent;
'import android.media.MediaPlayer;
'import android.os.Bundle;
'public class Splash extends Activity{
#Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.splash);
Thread timer = new Thread(){
public void run(){
try{
sleep(5000);
} catch(InterruptedException e){
e.printStackTrace();
}finally{
Intent openMain = new Intent("android.intent.action.TESTINGEMULATORACTIVITY");
startActivity(openMain);
}
}
};
timer.start();
}
#Override
protected void onPause() {
// TODO Auto-generated method stub
super.onPause();
finish();
}
'}
Any help would be greatly appreciated, thank you.
try this
public class SplashScreen extends Activity {
protected int _splashTime = 2000;
private Thread splashTread;
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.splash);
splashTread = new Thread() {
#Override
public void run() {
try {
synchronized(this) {
wait(_splashTime);
}
} catch(InterruptedException e) {
System.out.println("EXc=" + e);
}
finally {
startActivity(new Intent(SplashScreen.this, Login.class ));
//stop();
finish();
}
}
};
splashTread.start();
}
}
public class Welcome extends Activity
{
/** Called when the activity is first created. */
Handler mHandler,actHandler;
#Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.welcome);
new Thread(){
public void run(){
try{
Thread.sleep(3000);
}
catch(Exception ex){
Log.e("Welcome Exception :",ex.toString());
}
try{
Message msg=mHandler.obtainMessage();
mHandler.sendMessage(msg);
}
catch(NullPointerException ex){
Log.e("Handler Exception :",ex.toString());
}
}
}.start();
mHandler=new Handler(){
public void handleMessage(Message msg){
super.handleMessage(msg);
Intent i=new Intent(Welcome.this,M_chat.class);
startActivity(i);
finish();
}
};
}
}
Finish the activity and then start the other activity.
Thread timer = new Thread(){
public void run(){
try{
sleep(5000);
} catch(InterruptedException e){
e.printStackTrace();
}finally{
finish();
Intent openMain = new Intent("android.intent.action.TESTINGEMULATORACTIVITY");
startActivity(openMain);
}
}
};
This should work for you.
#Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.splash);
Thread timer = new Thread() {
public void run() {
try {
sleep(5000);
} catch(InterruptedException e){
e.printStackTrace();
} finally {
Intent openMain = new Intent("android.intent.action.TESTINGEMULATORACTIVITY");
startActivity(openMain);
Splash.this.finish();
}
}
};
timer.start();
}
I currently have a media player that is streaming a mp3. I have a seekbar, hwoever, it is not working. I have tried it with an actual raw file and that seems to work. I think the seekbar is not getting the duration of the song. any ideas?
Code:
public class SeekMe extends Activity implements Runnable{
/** Called when the activity is first created. */
MediaPlayer mp;
Button playButton;
Button stopButton;
SeekBar seekMe;
int total;
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
playButton = (Button)findViewById(R.id.play);
stopButton = (Button)findViewById(R.id.stop);
seekMe = (SeekBar)findViewById(R.id.seekBar1);
final MediaPlayer mp = new MediaPlayer();
try {
mp.setDataSource("http://dl.dropbox.com/u/24535120/Week%20of%20May%201/Swanky%20Tunes%20%26%20Hard%20Rock%20Sofa%20-%20Smolengrad%20%28Original%20Mix%29.mp3");
mp.setAudioStreamType(AudioManager.STREAM_MUSIC);
mp.prepareAsync();
} 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();
}
mp.setOnPreparedListener(new OnPreparedListener(){
#Override
public void onPrepared(MediaPlayer arg0) {
// TODO Auto-generated method stub
total = mp.getDuration();
}
});
seekMe.setProgress(0);
playButton.setOnClickListener(new OnClickListener(){
#Override
public void onClick(View arg0) {
mp.start();
seekMe.setMax(total);
}
});
stopButton.setOnClickListener(new OnClickListener(){
#Override
public void onClick(View arg0){
mp.pause();
}
});
seekMe.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
#Override
public void onStopTrackingTouch(SeekBar seekBar) {
// TODO Auto-generated method stub
}
#Override
public void onStartTrackingTouch(SeekBar seekBar) {
// TODO Auto-generated method stub
}
#Override
public void onProgressChanged(SeekBar seekBar, int progress,
boolean fromUser) {
// TODO Auto-generated method stub
if(fromUser){
mp.seekTo(progress);
seekMe.setProgress(progress);
}
}
});
Thread currentThread = new Thread(this);
currentThread.start();
}
#Override
public void run() {
// TODO Auto-generated method stub
try{
while(mp != null){
int currentPosition = mp.getCurrentPosition();
Message msg = new Message();
msg.what = currentPosition;
threadHandler.sendMessage(msg);
}
Thread.sleep(100);
}catch (InterruptedException e){
e.printStackTrace();
}
}
private Handler threadHandler = new Handler(){
public void handleMessage(Message msg){
seekMe.setProgress(msg.what);
}
};
}
Have you tried calling the default music player with the url of the mp3 file?
Intent i = new Intent(Intent.ACTION_VIEW);
i.setDataAndType(Uri.parse(url), "audio/*");
context.startActivity(i);