Alternate Solution for setJavaScriptEnabled(true);
you have to use it at Class Level like
@SuppressLint("SetJavaScriptEnabled")
public class MyActivity extends Activity
{
...
}
and according to me there is no other way to enable JavaScript
in WebView
and if your app really doesn’t require JavaScript
usage within a WebView then don’t call setJavaScriptEnabled(true).
The warning tells You that enabling Javascript may be not secure. Just check if You absolutely need to enable Javascript and if You need it, suppress warning by
@SuppressLint("SetJavaScriptEnabled")