java - Android simple WebView crash -
i'm creating simple application right , add webview on bottom of screen. webview on first page, when run application webview run. got error.
i use simple code, showing content of web.
here's xml code
<webview android:id="@+id/webview" android:layout_width="fill_parent" android:layout_height="0dip" android:layout_weight="1" />
and here's java code
webview browser = (webview) findviewbyid(r.id.webview); browser.loadurl("http://www.tutorialspoint.com");
i added internet permission on manifest.
here's logcat
06-26 10:09:18.657: e/androidruntime(25152): fatal exception: main 06-26 10:09:18.657: e/androidruntime(25152): process: com.indomultimedia.hellobali, pid: 25152 06-26 10:09:18.657: e/androidruntime(25152): java.lang.runtimeexception: unable start activity componentinfo{com.indomultimedia.hellobali/com.indomultimedia.hellobali.mainhelloballi}: java.lang.nullpointerexception 06-26 10:09:18.657: e/androidruntime(25152): @ android.app.activitythread.performlaunchactivity(activitythread.java:2282) 06-26 10:09:18.657: e/androidruntime(25152): @ android.app.activitythread.handlelaunchactivity(activitythread.java:2340) 06-26 10:09:18.657: e/androidruntime(25152): @ android.app.activitythread.access$800(activitythread.java:157) 06-26 10:09:18.657: e/androidruntime(25152): @ android.app.activitythread$h.handlemessage(activitythread.java:1247) 06-26 10:09:18.657: e/androidruntime(25152): @ android.os.handler.dispatchmessage(handler.java:102) 06-26 10:09:18.657: e/androidruntime(25152): @ android.os.looper.loop(looper.java:157) 06-26 10:09:18.657: e/androidruntime(25152): @ android.app.activitythread.main(activitythread.java:5293) 06-26 10:09:18.657: e/androidruntime(25152): @ java.lang.reflect.method.invokenative(native method) 06-26 10:09:18.657: e/androidruntime(25152): @ java.lang.reflect.method.invoke(method.java:515) 06-26 10:09:18.657: e/androidruntime(25152): @ com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:1265) 06-26 10:09:18.657: e/androidruntime(25152): @ com.android.internal.os.zygoteinit.main(zygoteinit.java:1081) 06-26 10:09:18.657: e/androidruntime(25152): @ dalvik.system.nativestart.main(native method) 06-26 10:09:18.657: e/androidruntime(25152): caused by: java.lang.nullpointerexception 06-26 10:09:18.657: e/androidruntime(25152): @ com.indomultimedia.hellobali.mainhelloballi.oncreate(mainhelloballi.java:58) 06-26 10:09:18.657: e/androidruntime(25152): @ android.app.activity.performcreate(activity.java:5389) 06-26 10:09:18.657: e/androidruntime(25152): @ android.app.instrumentation.callactivityoncreate(instrumentation.java:1105) 06-26 10:09:18.657: e/androidruntime(25152): @ android.app.activitythread.performlaunchactivity(activitythread.java:2246) 06-26 10:09:18.657: e/androidruntime(25152): ... 11 more
did set activity setcontentview(r.layout.your_layout); ?, on oncreate method of activity, or in fragment this:
view view = inflater.inflate(r.layout.your_layout, rootview, false);
this on oncreateview(layoutinflater,view,bundle);
Comments
Post a Comment