[android-developers] Re: How to link multiple HTML pages in assets folder ?
Hi Emanuel,
It is working. Thanks a lot for the reply.
Regards,
Harshani
On Sep 1, 10:37 pm, Emanuel Moecklin <1gravity...@gmail.com> wrote:
> Much easier and faster:
> webView.loadUrl("file:///android_asset/test1.html");
>
> As TreKing pointed out, relative links work well:
> <a href="test2.html">Click Me</a>
> If you really need absolute links:
> <a href="file:///android_asset/test2.html">Click Me</a>
>
> Emanuel
> 1gravity LLC
>
> On Aug 31, 3:03 pm,Harshani<harshini...@gmail.com> wrote:
>
>
>
>
>
>
>
> > I am new to Android.
>
> > I want to display HTML pages in android emulator. I put my
> > "test1.html" and "test2.html" files in the "assets" folder and managed
> > to display "test1.html" file in Android by using the following code.
>
> > package com.example.helloandroid;
>
> > import java.io.IOException;
> > import java.io.InputStream;
>
> > import android.app.Activity;
> > import android.os.Bundle;
>
> > public class Test extends Activity {
>
> > @Override
> > public void onCreate(Bundle savedInstanceState) {
> > super.onCreate(savedInstanceState);
> > WebView webview = new WebView(this);
> > setContentView(webview);
>
> > try {
>
> > InputStream fin = getAssets().open("test1.html");
> > byte[] buffer = new byte[fin.available()];
> > fin.read(buffer);
> > fin.close();
> > webview.loadData(new String(buffer), "text/html",
> > "UTF-8");
>
> > } catch (IOException e) {
> > e.printStackTrace();
> > }
> > }}
>
> > Now I want to click a button or a link in the "test1.html" file and
> > open the "test2.html" file.How can I link those two HTML pages?
>
> > Thanks in advance.
>
> > Regards,
>
> >Harshani
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home