Okhelp.cz

Recepty, články, nápady, programování. Dříve dum-zahrada, finance, internet a know-how.okhelp.cz Pro lepší výsledky hledání používejte i diakritiku.

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)


302

WebView.loadData utf-8 encoding Android | webview-loaddata-utf-8-encoding-android


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);

226

Eclipse Xml Incorrect Line Endings | eclipse-xml-incorrect-line-endings


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:
android/eclipse-xml-line-ending-error.png

android/eclipse-xml-line-ending-error-1.png
222

Disable enable internet connection in Android Emulator | disable-enable-internet-connection-in-android-emulator


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 )


 public boolean isNetworkAvailable() {
        ConnectivityManager cm = (ConnectivityManager) 
          getSystemService(Context.CONNECTIVITY_SERVICE);
        NetworkInfo networkInfo = cm.getActiveNetworkInfo();
        if (networkInfo != null && networkInfo.isConnected()) {
            return true;
        }
        return false;
    }