Android

Android – Activity has leaked ServiceConnection that was originally bound here

Posted by stevenmarkford on April 15, 2012 at 12:16 am

Problem Android activity gives the error “Activity has leaked ServiceConnection that was originally bound here” when exiting. Cause When working with a bound service one sets up a connection to the service from the client activity by binding the ServiceConnection class by calling “bindService(intent, mConnection, Context.BIND_AUTO_CREATE);” when the service starts. The error is caused when [...]

Android – Failed to install .apk on device : timeout Eclipse Error

Posted by stevenmarkford on April 11, 2012 at 10:52 pm

Problem Eclipse console shows the error “Failed to install *.apk on device ‘*’: timeout” Cause The time taken to install the apk via the adb tool exceeded the adb default connection timeout value. If this only happens on occasion this may be because your processor is currently being heavily used by another process (check task [...]

Android – sharing debug.keystore in Eclipse

Posted by stevenmarkford on March 16, 2012 at 1:25 pm
android-sharing-debug-keystore-eclipse-01

If you find you frequently debugging an Android application on multiple computers then it can save time to share a single debug.keystore across those computers. If you don’t have a shared a debug.keystore you will get the error eclipse console error “Re-installation failed due to different application signatures.” (for more details see my post http://www.stevenmarkford.com/solution-to-reinstallation-failed-due-to-different-application-signatures-when-debugging-in-eclipse/) [...]

Android – Sharing Java Project Code Package in Eclipse

Posted by stevenmarkford on March 13, 2012 at 11:42 pm
android_sharing_prj_in_eclipse_01

This example demonstrates how to share a project’s code across multiple Android projects (that is how to share a libraries code). Step 1: Mark the shared project as a library 1. In the Eclipse Project Explorer, right click on the project you wish to share. 2. Click on Properties 3. In the Android section tick [...]

Android – HTML Webview Button Call Java Activity Method

Posted by stevenmarkford on March 12, 2012 at 9:52 pm

To call a method which is in your activity from a standard HTML button is actually very easy. Assuming you have the following html file in your project assets\web\index.html: <html> <head> <script type=”text/javascript”> function ClientSideMethod(message){ var x=document.getElementById(“te”);    x.innerHTML = message; } </script> </head> <body> <div id=”te”></div> <button onClick=”ClientSideMethod(‘client side method called’)”> Call Javascript Method [...]