运行一个android程序,直接访问某个网站

package android.com.youtube;
 
import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.Window;
import android.view.WindowManager;
 
public class YoutubeActivity extends Activity
?
1
2
    
{
      public void onCreate(Bundle savedInstanceState)
?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
    
{
         
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        Uri uri = Uri.parse("http://www.cnblogs.com/chen-lhx/");
        Intent it = new Intent(Intent.ACTION_VIEW, uri);
        it.setData(uri); 
        it.setAction( Intent.ACTION_VIEW); 
        it.setClassName("com.android.browser","com.android.browser.BrowserActivity"); 
        YoutubeActivity.this.startActivity(it);
    }
     
    public void onRestart(){
         finish();
         System.exit(0);
    }
  
}

 

posted @ 2014-10-16 17:14  龙昊雪  阅读(583)  评论(0编辑  收藏  举报