Motivation:
Development of a back word software. The feature of the screen is not implemented.
Method:
The first step is to try:
In Mainactivity, when you add the following code, the time in the text box changes when you click in the blank space of the view.
@Override
public boolean ontouchevent (Motionevent event) {
TODO auto-generated Method Stub
Final TextView TextView = (TextView) Findviewbyid (R.ID.TEXT2);
Date date = new Date ();
SimpleDateFormat SDF = new SimpleDateFormat ("Yyyy-mm-dd HH:mm:ss");
String currentdate = Sdf.format (date);
Textview.settext (currentdate);
Return Super.ontouchevent (event);
}
The second step is to try:
@Override
public boolean ontouchevent (Motionevent event) {
if (event.getaction () = = Motionevent.action_down) {
int screenwidth = Getwindowmanager (). Getdefaultdisplay (). GetWidth ();
int screenheight = Getwindowmanager (). Getdefaultdisplay ()
. GetHeight ();
if (Event.getx () < SCREENWIDTH/2) {
if (StartPage > 1)
startpage--;
Else
Toast.maketext (Readview.this, "Already the first page", Toast.length_long)
. Show ();
} else {
if (StartPage < totalpages)
startpage++;
Else
Toast.maketext (Readview.this, "Already the last page", Toast.length_long)
. Show ();
}
Refreshlist ();
}
Return Super.ontouchevent (event);
}
This realizes the function of the touch screen paging.