Reputation: 1
I am using WebView
for displaying dynamic content from server, which can be a normal string, link or an image. Please suggest how to handle this and show in a WebView
.
This is an example of the data I am getting from server.
String test ="PRESS RELEASE
\r\nToday, as Heads of State and ministers from more than 150 countries come together in New York to sign the climate agreement finalised in December last year, international humanitarian and development network has hailed the moment as a long needed move towards concrete action for the most vulnerable communities of the world.\r\nThe signing, which signals a confirmed commitment to implementing the agreement, comes after years of negotiations among governments to agree on how to tackle climate change together.\r\nI am happy to see so many ministers and Heads of States coming together to sign the Paris Agreement, said ABCD board member, Birgitte Qvist Sørensen, who is attending the signing ceremony in New York. Their signatures symbolise a commitment to taking the agreement forward, and to turn it into concrete action. Some of the smallest, and poorest, countries seem to be the most eager to sign the agreement, and to begin implementation. For them climate change is a question about survival and future development, and there is no time to lose. Let the work begin!\r\nABCD General Secretary, John Nduna, added: As a faith based network working at community level and from our engagement with poor and vulnerable people around the world, we know the challenges climate change is causing already today. The Paris agreement has given us a pathway towards a green and sustainable future, where nobody should be left behind. We hope that this signal today by governments of the world will lead to increased ambition, to a sharing of the burdens, and to moving forward in partnership.\r\nABCD through its 140 members across the world has been working in the area of environmental sustainability with communities on the ground for many years. In Central America where the El Nino phenomenon has caused severe drought across numerous countries, ABCD members are on the ground working on projects to protect restore the environment, providing environmental education, and working with environment ministries in support of policies that will contribute to keeping global warming below 1.5 degrees.\r\nIn 2015 members of the alliance brought hundreds of thousands of voices from communities to the global arena through a three-month journey cycling through eight countries from Mozambique to Kenya and a pilgrimage from Norway to Paris, in a petition of signatures handed to UN Executive Secretary Christiana Figueres at the Paris COP21 in December calling for climate justice.\r\nEarlier in the week on Monday 18 April more than 200 senior religious leaders from religions of the world delivered a global call for ambitious action to be taken to address climate change. Their statement, supported by thousands around the world including ABCD, was handed to the President of the UN general assembly, Mogens Lykketoft, calling on governments to sign, ratify and implement the Paris Agreement. For the full statement click here: http://www.interfaithstatement2016.org/statement>http://www.interfaithstatement2016.org/statement\r\nENDS\r\n\r\nUpvotes: 0
Views: 3755
Reputation: 4345
try the following code
webView= (WebView) findViewById(R.id.webview);
webView.setWebChromeClient(new WebChromeClient());
webView.getSettings().setJavaScriptEnabled(true);
webview.getSettings().setPluginsEnabled(true);
webView.loadUrl(url);
webView.setWebViewClient(new WebViewClient(){
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url){
view.loadUrl(url);
return true;
}
});
this may helps you
Upvotes: 0
Reputation: 72
You need to add WebViewClient to your WebView in order to open it in the WebView. Something like
mWebView.setWebViewClient(new WebViewClient() {
@Override
public boolean shouldOverrideUrlLoading(WebView pView, String pUrl) {
pView.loadUrl(purl);
return false;
}
});
Upvotes: 1