Note that there are some explanatory texts on larger screens.

plurals
  1. POAndroid: trying to use html img or Webview causes me problems
    primarykey
    data
    text
    <p>hi I'm trying to load up a html file via a Custom Alert box, to take advantage of formatting. but my app crashes when ever I launch the dialog. I had a problem yesterday too when I was just using html string conversion, I could get things like bold text working, but couldn't encourage it to use an image file located in my root/assets folder. I wonder if its a code error or am I referencing my assets folder incorrectly. I know it sounds like two problems but I'm hoping they are related?</p> <p>I've tried with and without the JS true, there is no js in my html file, and its very basic.</p> <pre><code> WebView mWebView = (WebView) findViewById(R.id.webView); mWebView.getSettings().setJavaScriptEnabled(true); mWebView.loadUrl("file:///android_asset/helppage.html"); </code></pre> <p>Error Dump</p> <pre><code> 03-24 14:20:59.800: W/dalvikvm(5574): threadid=1: thread exiting with uncaught exception (group=0x4001e578) 03-24 14:20:59.800: E/AndroidRuntime(5574): FATAL EXCEPTION: main 03-24 14:20:59.800: E/AndroidRuntime(5574): java.lang.NullPointerException 03-24 14:20:59.800: E/AndroidRuntime(5574): at com.mediabar.timelapse.TimeLapseActivity.createDialog(TimeLapseActivity.java:140) 03-24 14:20:59.800: E/AndroidRuntime(5574): at com.mediabar.timelapse.TimeLapseActivity$3.onClick(TimeLapseActivity.java:66) 03-24 14:20:59.800: E/AndroidRuntime(5574): at android.view.View.performClick(View.java:2538) 03-24 14:20:59.800: E/AndroidRuntime(5574): at android.view.View$PerformClick.run(View.java:9152) 03-24 14:20:59.800: E/AndroidRuntime(5574): at android.os.Handler.handleCallback(Handler.java:587) 03-24 14:20:59.800: E/AndroidRuntime(5574): at android.os.Handler.dispatchMessage(Handler.java:92) 03-24 14:20:59.800: E/AndroidRuntime(5574): at android.os.Looper.loop(Looper.java:130) 03-24 14:20:59.800: E/AndroidRuntime(5574): at android.app.ActivityThread.main(ActivityThread.java:3691) 03-24 14:20:59.800: E/AndroidRuntime(5574): at java.lang.reflect.Method.invokeNative(Native Method) 03-24 14:20:59.800: E/AndroidRuntime(5574): at java.lang.reflect.Method.invoke(Method.java:507) 03-24 14:20:59.800: E/AndroidRuntime(5574): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:907) 03-24 14:20:59.800: E/AndroidRuntime(5574): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:665) 03-24 14:20:59.800: E/AndroidRuntime(5574): at dalvik.system.NativeStart.main(Native Method) </code></pre> <p>EDIT: Added activity</p> <pre><code>public class mainActivity extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); overridePendingTransition(R.anim.pull_left_in, R.anim.push_right_out); setContentView(R.layout.main); Button help = (Button) findViewById(R.id.help); help.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { createDialog(); } }); } public void createDialog() { final Dialog dialog = new Dialog(CopyOfTimeLapseActivitybackup.this); dialog.setContentView(R.layout.help_dialog); dialog.setTitle("Help Area"); WebView mWebView = (WebView) findViewById(R.id.webView); mWebView.loadUrl("file:///android_asset/helppage.html"); Button button = (Button) dialog.findViewById(R.id.okButton); button.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { dialog.dismiss(); } }); dialog.show(); } } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload