1

I would like to make help system for my app. My idea is to display full screen dialog (or almost full size) with html pages. Moreover I would like to work this help system fully offline and not to use any external web browser. Additionally help system should be ready for few languages support.

How should I do that? Is there any widget ready from shelf. How to put html pages as resources (language dependend)?

Any other suggestions how to prepare good help system?

Thanks in advance.

user2707175
  • 1,133
  • 2
  • 17
  • 44

3 Answers3

2
@Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        WebView webView=(WebView)findViewById(R.id.webView);
    webView.getSettings().setBuiltInZoomControls(true);
    webView.getSettings().setJavaScriptEnabled(true);

    webView.loadUrl("file:///android_asset/www/index.html");
Ankit Srivastava
  • 354
  • 1
  • 5
  • 24
  • the file index.html should be inside assets folder – Ankit Srivastava Nov 14 '13 at 22:22
  • how to inform Android which file to select depending on the language version (automatically)? – user2707175 Nov 14 '13 at 22:30
  • i didn't get you...??what version are u talking about? – Ankit Srivastava Nov 14 '13 at 22:59
  • I want to have the same file in many versions, ex. one for English, one for French, one for... etc. I would expect that Android will select automatically the appropriate version depending on the current system settings. – user2707175 Nov 14 '13 at 23:29
  • http://stackoverflow.com/questions/4985805/set-locale-programatically check this out....the answer will help you to get the language and set it as well... in your case you will not have to use the code for setting the language......but instead display the other webpage... – Ankit Srivastava Nov 15 '13 at 11:11
1

Use a WebView, and store your html files on the assets folder e.g.

  WebView webview = (WebView) findViewById(R.id.webView1);  
  webview.loadUrl("file:///android_asset/help.html");
antoniom
  • 3,143
  • 1
  • 37
  • 53
1

The above answer is correct. Just to add on it, you can also convert the html content to XML and keep it in the strings.xml file. Then you can use the resource as you use the normal string.

WebView webView=(WebView)findViewById(R.id.webView);
webview.loadData( getString(R.string.ResourceName), "text/html", "utf-8" );

or

webview.loadDataWithBaseURL( null, getString(R.string.ResourceName), "text/html", "utf-8", null );

EDIT- Here is the link for HTML to XML conversion.

For multiple language support follow this link.

For each HTML file just convert it into XML. Then -

<string name="help">Your XML content</string>
Naddy
  • 2,664
  • 6
  • 25
  • 38
  • great, thanks a lot! how to convert html to xml? do I understand well for each html file I will have one xml file in string folder? and how to make the help system language dependend (android opens automaticaly file for the appropriate language)? – user2707175 Nov 14 '13 at 22:29
  • Great man, you are very helpful. Now I know all what I needed, it's time to checking this in practice. Thanks a lot. – user2707175 Nov 14 '13 at 23:31