I created a WebView which loads google.com as test. And at the bottom of the Layout ist a SeekBar. If the Seekbar is changed to progress of 2 it shall for example load another page like stackoverflow.com. If its progress is changed to 3,it shall load another page ( android.com)
My existing code is the following. But I dont know how to fill the listener now. Also with existing solutions it did not work.
activity_main.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<WebView android:id="@+id/Viewing"
android:layout_width="fill_parent"
android:layout_height="fill_parent" />
<SeekBar
android:id="@+id/seitenSwitcher"
android:layout_above="@+id/seitenSwitcher"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:max="15"
android:progress="0"
android:paddingLeft="4dip"
android:paddingRight="4dip"
/>
</RelativeLayout>
main.java
package testprojekt.homepageapp.application;
import android.app.Activity;
import android.os.Bundle;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.SeekBar;
public class main extends Activity {
private WebView webv;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
webv = (WebView)findViewById(R.id.Viewing);
webv.setWebViewClient(new WebViewClient());
webv.getSettings().setJavaScriptEnabled(true);
webv.loadUrl("http://www.google.de");
}
public void onProgressChanged(SeekBar seitenSwitcher, int progress, boolean true) {
seitenSwitcher = (SeekBar) findViewById(R.id.seitenSwitcher);
seitenSwitcher.setOnSeekBarChangeListener(new sbListener());
}
}
sbListener.java
package testprojekt.homepageapp.application;
import android.widget.SeekBar;
public class sbListener implements SeekBar.OnSeekBarChangeListener {
???
}