我的应用程序崩溃了。
这是出错的代码!
public void wbsuche(View view) {
String url = "http://www.xxxxx.de/s/?tag=xxxxx&link_code=wsw&_encoding=UTF-8&search-alias=aps&field-keywords=";
String zrlll = "&Submit.x=-89&Submit.y=-23&Submit=Go";
EditText et = (EditText) findViewById(R.id.editText1);
String cstrsk = et.getText().toString().trim();
WebView wv = (WebView) findViewById(R.id.suche_wbv);
setContentView(R.layout.suche_wb);
wv.loadUrl(url + cstrsk + zrlll);
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(et.getWindowToken(), 0);
wv.setWebViewClient(new wb_c_suche());
progress = (ProgressBar) findViewById(R.id.progressBar1);
progress.setVisibility(View.GONE);
TV = (TextView) findViewById(R.id.ladedaten1);
TV.setVisibility(View.GONE);
imgbg1 = (ImageView) findViewById(R.id.bgimg);
imgbg1.setVisibility(View.GONE);
}
希望有人能帮助我
最佳答案
您绝对应该插入设备并查看 logcat 输出。我知道您说过您的设备上没有收到崩溃报告,但实际上您确实收到了。拥有查看堆栈跟踪的方法至关重要。
话虽如此,您是否在调用 findViewById()
之前设置内容 View ?如果不是,您的 Activity 没有要遍历的 View 层次结构,并且您的 WebView 对象在此行上将为 null:
WebView wv = (WebView) findViewById(R.id.suche_wbv);
当您尝试在该 Web View 上调用 loadUrl()
时,您将因空指针异常而崩溃。
关于java - Android Eclipse 字符串 Txt + Edittext + 字符串 Txt = 崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20521458/