I have an search box with under the search box an webview.
when i type in the search box “hello”, the webview show the html file “hello.html”
But when i change (“file:///android_asset/”+srt) to (“file:///android_asset/main/”+srt)
The webview says that the file main/hello.html can’t find.
my full code is this:
package com.kerk.liedboek;
import com.kerk.liedboek.R;
import android.app.Activity;
import android.os.Bundle;
import android.view.KeyEvent;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.Window;
import android.view.View.OnClickListener;
import android.webkit.WebChromeClient;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
public class psalmen extends Activity {
WebView webview;
/** Called when the activity is first created. */
final Activity activity = this;
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
this.getWindow().requestFeature(Window.FEATURE_PROGRESS);
setContentView(R.layout.main);
webview = (WebView) findViewById(R.id.webview);
webview.getSettings().setJavaScriptEnabled(true);
Button button = (Button) findViewById(R.id.button1);
button.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
EditText edit = (EditText) findViewById(R.id.editText1);
String str = edit.getText().toString() +".html";
webview.loadUrl("file:///android_asset/main/"+str); }
});
}
}
What am i doing wrong?
when i have (“file:///android_asset/”+str) it works fine but with the other one not.
I hope you understand me and that you can help me.
Gromdroid
You cannot have subfolders in any of the Android resource folders.
Res Help 1
Res Help 2
but it looks like your trying to load a html file. Put it in your raw folder:
then use: