度娘说:Intent intent= new Intent();        
        intent.setAction("android.intent.action.VIEW");    
        Uri content_url = Uri.parse("www.baidu.com");   
        intent.setData(content_url);           
        intent.setClassName("com.android.browser","com.android.browser.FMSActivity");   
        startActivity(intent);
然后修改xml: <intent-filter>
                  <action android:name="android.intent.action.VIEW" />
                  <category android:name="android.intent.category.DEFAULT" />
                  <category android:name="android.intent.category.BROWSABLE" />
                  <data android:scheme="file" />
              </intent-filter>
Log:12-21 05:54:56.367: E/AndroidRuntime(277):  at sz.zd.SzActivity.onCreate(SzActivity.java:19)
问题: startActivity(intent);

解决方案 »

  1.   

    哪有这样复杂,xml不用改任何东西,只需要在类中加上这几句话即可:
    Uri myBlogUri = Uri.parse("http://xxxxx.com");  
    Intent returnIt = new Intent(Intent.ACTION_VIEW, myBlogUri);
    startActivity(returnIt); 
      

  2.   

    public void open_web(String url) throws UnsupportedEncodingException {
     url = url.replaceAll("(\\r|\\n)", "");
    if(URLUtil.isValidUrl(url)){
        Uri uri = Uri.parse(url);
        Intent browserIntent = new Intent(Intent.ACTION_VIEW);
        browserIntent.setDataAndType(uri, "text/html");
        browserIntent.addCategory(Intent.CATEGORY_BROWSABLE);
        startActivity(browserIntent);
    }else{
        Log.w("","Invalid URL");
     
    }这将会打开默认android浏览器。