package com.example.webview;
import android.R.string;
import android.support.v7.app.ActionBarActivity;
import android.support.v7.app.ActionBar;
import android.support.v4.app.Fragment;
import android.content.Intent;
import android.content.Loader;
import android.net.Uri;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.os.Build;
public class MainActivity extends ActionBarActivity {
private String url="http://nba.hupu.com/";
private WebView webview;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.web);
Uri uri =Uri.parse(url);
Intent intent =new Intent(Intent.ACTION_VIEW,uri);
startActivity(intent);
init();
}
private void init() {
// TODO 自动生成的方法存根
webview=(WebView) findViewById(R.id.webview);
webview.loadUrl("http://m.hupu.com");
webview.setWebViewClient(new WebViewClient(){
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
// TODO 自动生成的方法存根
view.loadUrl(url);
return true;
}
});
}
}