Android調用系統播放器

Java代碼
package cn.com; 
 
import android.app.Activity; 
import android.content.Intent; 
import android.net.Uri; 
import android.os.Bundle;  www.aiwalls.com
 
public class Video extends Activity { 
     
    Stringpath = "file:///sdcard/tmp60115.mp4";
     
    /** Called when the activity is first created. */ 
    @Override 
    public void onCreate(Bundle savedInstanceState) { 
        super.onCreate(savedInstanceState); 
        setContentView(R.layout.main); 
         
        Intent it = new Intent(Intent.ACTION_VIEW); 
        Uri uri = Uri.parse(path); 
        it.setDataAndType(uri , "video/mp4"); 
        startActivity(it); 
         
    } 

摘自 sql_help的專欄

發佈留言