好的我在每个标签上运行带有webview的tabhost应用程序,每个webview url以?id =结尾,在标签5上我有一个textview和一个按钮,这样当用户键入一个值时它会保存它会在?id =的末尾加载该值,但是当我按下我的按钮时,它只会打开一个空白的白色屏幕并使我的标签主机消失,而不是使用新的webview网址重新加载所有标签。为什么要打开一个新的空白屏?
选项卡5,带有文本视图和按钮
public class Tab5 extends Activity{
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.tab5);
Button btnGo;
btnGo = (Button) findViewById(R.id.button1);
final EditText edit = (EditText) findViewById(R.id.editText1);
btnGo.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(Tab5.this, Tab1.class);
intent.putExtra("com.sideresult.outputapps.NAME", edit.getText().toString());
startActivity(intent);
}
});
}
其中一个webview标签的示例
public class Tab1 extends Activity {
private WebView webView;
public final static String URL = "outputapps.com/build/infoview.php?id=";
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.tab1);
webView = (WebView) findViewById(R.id.webView1);
webView.getSettings().setJavaScriptEnabled(true);
Intent intent = getIntent();
String name = intent.getStringExtra("com.sideresult.outputapps.Name");
webView.loadUrl(Tab1.URL + name);
webView.setWebViewClient(new MyAppWebViewClient());
WebSettings settings = webView.getSettings();
settings.setLoadWithOverviewMode(true);
settings.setUseWideViewPort(true);
}