//. . .
public class MainActivity extends Activity {
//. . .
@Override
protected void onCreate(Bundle savedInstanceState) {
//. . .
mainActivityProcedure ();
}
//. . .
public static void mainActivityProcedure () {
//. . .
AnotherActivity.anotherActivityProcedure () ;
SomeActivity.someActivityProcedure ();
//. . .
}
//. . .
}
//. . .
public class SomeActivity extends Activity {
//. . .
@Override
protected void onCreate(Bundle savedInstanceState) {
//. . .
someWebView = (WebView) findViewById (R.id.someWebView);
//. . .
}
//. . .
public static void someActivityProcedure () {
//. . .
try {
someWebView.loadDataWithBaseURL (null , someHTMLCode, mimeType, encoding, null);
catch (Exception e) {
Log.i("SomeActivity", "someWebView loadDataBaseURL() " + e.toString());
}
//. . .
}
//. . .
}
//. . .
public class AnotherActivity extends Activity {
//. . .
@Override
protected void onCreate (Bundle savedInstanceState) {
//. . .
anotherWebView = (WebView) findViewById (R . id.anotherWebView) ;
//. . .
}
//. . .
public static void anotherActivityProcedure () {
//. . .
anotherWebView . loadDataWithBaseURL (null, anotherHTMLCode, mimeType, encoding, null) ;
//. . .
}
}
AnotherActivityProcedure調用時,AnotherActivity總是加載另一個HTLCode。 SomeActivity負載someHTMLCode除非mainActivityProcedure從MainActivity.onCreate調用。 出了什麼問題someWebView或SomeActivity? 我不能在這裏把原來的代碼。WebView loadDataWithbaseURL java.lang.NullPointerException
增加:Replacin`空在loadDataWithBaseURL()不解決它。 增加:logcat的顯示,提出Log.i()從捕獲的消息顯示java.lang.NullPointerException。
安置自己的日誌貓跟蹤 – Pragnani 2013-03-11 04:40:39
logcat的顯示,通過someWebView – Sunshine 2013-03-11 04:52:27
拋出這是很難找出問題,而不logcat的跟蹤和代碼 – Pragnani 2013-03-11 05:16:10