View overrides onTouchEvent but not performClick
public class Panel extends SurfaceView implements SurfaceHolder.Callback {
//............... code
//............... some code
/**
* Process the MotionEvent.
*/
@Override
public boolean onTouchEvent(MotionEvent event) {
synchronized (getHolder()) {
if (event.getAction() == MotionEvent.ACTION_DOWN) {
performClick();
} else if (event.getAction() == MotionEvent.ACTION_MOVE) {
if(_currentGraphic==null)return true;
} else if (event.getAction() == MotionEvent.ACTION_UP) {
}
return true;
}
}
/////////////////////////////
@Override
public boolean performClick() {
// Calls the super implementation, which generates an AccessibilityEvent
// and calls the onClick() listener on the view, if any
super.performClick();
// Handle the action for the custom click here
return true;
}
}
396LW NO topic_id
AD
Další témata ....(Topics)
Try this solution:
String DATA = "Html text....bla bla bla. Hellou world! čšřžěéá";
String HEADERHTML =
"<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">"
+"<html> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8">"
+"</head> <body>";
String FOOTERHTML = "</body></html>";
WebView mWebView.loadData(HEADERHTML+DATA+FOOTERHTML,"text/html; charset=UTF-8",null);
Incorrect line ending: found carriage return (\r) without corresponding newline (
)
Move mouse cursor on error text and press Ctrl+1
Select Fix line endings and press Enter
See image below:
)
Move mouse cursor on error text and press Ctrl+1
Select Fix line endings and press Enter
See image below:
If you try function for checking internet connection you can disable internet on the emulator:
Settings - Wireless and networks - Mobile networks - Data enabled (checked - unchecked )
Settings - Wireless and networks - Mobile networks - Data enabled (checked - unchecked )
public boolean isNetworkAvailable() {
ConnectivityManager cm = (ConnectivityManager)
getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo networkInfo = cm.getActiveNetworkInfo();
if (networkInfo != null && networkInfo.isConnected()) {
return true;
}
return false;
}
Code look up at the Api Demos
android_fragments arguments attributes - three fragments on screen
android_fragments_alert_dialog
android_fragments_context_menu
android_fragments_custom_animation
android_fragments_dialog
android_fragments_dialog_or_activity
fragment_hide_show
fragment_layout
fragments_list_array
fragment_menu
android_fragments_get_result_from_fragment and tabs in two rows
android_fragments_recive_result
android_fragments_stack
fragment_tabs
android_fragments arguments attributes - three fragments on screen
android_fragments_alert_dialog
android_fragments_context_menu
android_fragments_custom_animation
android_fragments_dialog
android_fragments_dialog_or_activity
fragment_hide_show
fragment_layout
fragments_list_array
fragment_menu
android_fragments_get_result_from_fragment and tabs in two rows
android_fragments_recive_result
android_fragments_stack
fragment_tabs
How install Android emulator on PC
//developer.android.com/sdk/installing.html
Download links:
Java Development Kit JDK download
Eclipse download
Android SDK download
//developer.android.com/sdk/installing.html
Download links:
Java Development Kit JDK download
Eclipse download
Android SDK download
Editace: 2015-02-21 20:04:24
Počet článků v kategorii: 396
Url:view-overrides-ontouchevent-but-not-performclick