I have list of tweets being displayed in my listview. I have setup a listener on my listview which should take the user to the specific tweet.
The listener on my list is as follow:
listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
Intent intent = new Intent(TweetActivity.this, WebActivity.class);
intent.putExtra("url", String.valueOf(twitterBaseURL+tweetResult.get(i).getId()));
startActivity(intent);
}
});
Inside my web activity class, I am doing something as follow:
String url = getIntent().getExtras().getString("url");
WebView webView = (WebView) findViewById(R.id.webView);
webView.getSettings().setJavaScriptEnabled(true);
webView.getSettings().setJavaScriptCanOpenWindowsAutomatically(true);
webView.setWebChromeClient(new WebChromeClient());
webView.setWebViewClient(new WebViewClient());
webView.getSettings().setDomStorageEnabled(true);
webView.loadUrl(url);
In the web view it does not load the page like it does in google chrome on a mobile. I think the javascript does not load properly.
UPDATE 1:
I was testing this on an android device with API 21. Inside my android studio I have a virtual device with an API 23. In API 23 this loads everything properly. I created another virtual device with API 21 and tested to double check so the problem is with the API levels. This code works in API 23 to load the url properly inside the web view but does not in API 21?