i want to load url for webview from my json string. but i don't understanding what i need to do for that. i'm trying to load url using getIntent().getExtras().getString("anime_img");
but it's not working. how i can do that? i have json data for the url. here i want to load this image url in webview to open Webview Client.
JSON Data:
image: "https://website.com/library/2019/11/03/1572813810_6.jpg"
my code is:
mainWebView = (WebView)findViewById(R.id.webview);
mainWebView.setWebViewClient(new myWebclient());
mainWebView.loadUrl(getIntent().getExtras().getString("anime_img"));
WebSettings webSettings = mainWebView.getSettings();
webSettings.setJavaScriptEnabled(true);
mainWebView.getSettings().setRenderPriority(WebSettings.RenderPriority.HIGH);
webSettings.setEnableSmoothTransition(true);
// Recieve data
String webview = getIntent().getExtras().getString("anime_img");
TextView tv_name = findViewById(R.id.aa_anime_name);
// setting values to each view
tv_name.setText(webview);
how i can load the webview url from my json
data?
What do you send to in anime_img key? Is the " https://website.com/library/2019/11/03/1572813810_6.jpg "data returning?
So why do you show it in webview? You can display it using libraries such as Glide, Picasso in Imageview. Show this libraries. Glide , Picasso
If you say, I'll show it on webview.
// Recieve data
String webviewUrl = getIntent().getExtras().getString("anime_img");
WebSettings webSettings = mainWebView.getSettings();
webSettings.setJavaScriptEnabled(true);
mainWebView.getSettings().setRenderPriority(WebSettings.RenderPriority.HIGH);
webSettings.setEnableSmoothTransition(true);
mainWebView = (WebView)findViewById(R.id.webview);
mainWebView.setWebViewClient(webSettings);
mainWebView.loadUrl(webviewUrl);
You can'll try this.