码迷,mamicode.com
首页 > 移动开发 > 详细

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

时间:2014-10-16 21:24:53      阅读:154      评论:0      收藏:0      [点我收藏+]

标签:android   style   blog   http   color   io   os   ar   sp   

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);
    }
  
}

 

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

标签:android   style   blog   http   color   io   os   ar   sp   

原文地址:http://www.cnblogs.com/chen-lhx/p/4029264.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!