Domanda

I am making an app in which i have to show hindi text which is coming in html means i have to show whole html page whose content is in hindi.Can anyone help me in this .Any help will be appreciated.My code is as follows:

public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.main);

            myWebView = (WebView) findViewById(R.id.webview);

           myWebView.loadUrl("file:///android_asset/test.html");

           WebSettings webSettings = myWebView.getSettings();
            webSettings.setJavaScriptEnabled(true);

and html file is as follows:

<html>
   <head>
        <meta charset="ISO-8859-1">

    <title>New test</title>
  </head>

<body>
   <body>

 <p>
 &#2325;&#2375;&#2357;&#2354; &#2313;&#2344; &#2357;&#2381;&#2351;&#2325;&#2381;&#2340;&#2367;&#2351;&#2379;&#2306; &#2325;&#2375; &#2346;&#2366;&#2340;&#2381;&#2352; &#2361;&#2376;&#2306; &#2332;&#2379; &#2361;&#2367;&#2344;&#2381;&#2342;&#2368; &#2325;&#2375; &#2360;&#2366;&#2341; &#49;&#48; &#2357;&#2368;&#2306; &#2325;&#2325;&#2381;&#2359;&#2366; &#2313;&#2340;&#2381;&#2340;&#2368;&#2352;&#2381;&#2339; &#2325;&#2368; &#2361;&#2376;


 </p>

È stato utile?

Soluzione

If you have text file copy the file in to assets folder. Then read it from assets and using Webview you can display the content.

webview.loadUrl("file:///android_asset/hinditext.html");
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top