webview app: choosing a file doesn’t work

Follow the stated code below : public class MainActivity extends Activity { private WebView webView; private String urlStart = “http://www.example.com/mobile/”; private static final int FILECHOOSER_RESULTCODE = 2888; private ValueCallback<Uri> mUploadMessage; //Camera parameters private Uri mCapturedImageURI = null; @SuppressLint(“SetJavaScriptEnabled”) @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); webView = (WebView) findViewById(R.id.webView); webView.getSettings().setJavaScriptEnabled(true); webView.getSettings().setLoadWithOverviewMode(true); webView.getSettings().setAllowFileAccess(true); webView.loadUrl(urlStart); webView.setWebChromeClient(new … Read more

How to parse JSON response to show Image and Webview.

Try doing something like this. This is not the exact solution and you’ll have to work around your way. NSString *link = [NSString stringWithFormat:@”yourServiceURL”]; NSString *encdLink = [link stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]; NSURL *url=[NSURL URLWithString:encdLink]; NSData *response = [NSData dataWithContentsOfURL:url]; NSError *error; NSArray *jsonArray = [NSJSONSerialization JSONObjectWithData:response options: NSJSONReadingMutableContainers error: &error]; Now you have your data in the … Read more

App crashes when a button is clicked to load a webview

Check here @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); } public void login(View v) { webView = (WebView)findViewById(R.id.home); } } You Are finding view from setContentView(R.layout.activity_main); and there is no any webview in activity_main.xml so it shows you Null Pointer exception. it can not find view from different layout. use your webview in activity_main.xml … Read more