i'm implemented the project in web-view. it retries the data from sqlite . i need next and previous button in the web-view. if i touch on next button it will display the next record in that database.(previous also )
Thanks, Vinay
On the top of Webview put two buttons with Next and Previous Arrows.
In the onClick() of Next write the goForward code and in Previous write goBack code as below
@Override
public void onClick(View v)
{
if(v==btnNext)
{
if(webView.canGoForward())
{
webView.goForward();
}
}
if(v==btnPrevious)
{
if(webView.canGoBack())
{
webView.goBack();
}
}
}
试试这个,首先存储所有记录字符串数组。
String[] str = {"one", "two", "", "three"};
int record= 0;
next.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
record = record +1;
myWebView.loadData(record[1], "text/html; charset=UTF-8", null);
}
});
previous.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
record = record -1;
myWebView.loadData(record[1], "text/html; charset=UTF-8", null);
}
});