Category: Android

Eclipse XML Layout Text Editor Broken

When editing xml layout file for Android in Eclipse you might encounter the xml being wrong, flipping and broken. When changing tabs between the graphical layout and the xml file, the lines of code will start disappearing or moving around. It

Tagged with: , ,

Android 4.2 Enable Developer Options

Developer Options is gone, almost. It’s not just on Nexus 7 or Galaxy Nexus. Google has hidden the developer settings in the latest version of Jelly Bean, 4.2 for some reason. You can however easily enable it again. Go to the

Tagged with: ,

Eclipse Find/Search In Project

To search in your project in Eclipse do the following: Ctrl + H Choose File Search for plain text in project. Choose the relevant tab for a specific expression searches.

Tagged with: , ,

Android Set EditText Cursor Color

To set the EditText in Android you first need to set the textCursorDrawable to null. This is needed for Android 3.2 and up. android:textCursorDrawable=”@null” Setting this will result in the cursor color will be set to the textColor android:textColor  

Tagged with: , ,

Android Resource Entry Is Already Defined

When you compile an android project from its xml resource, Eclipse considers it as executing xml file and so you get some output from it, in the same name of the xml with .out.xml extension. And you’ll end up with

Tagged with: , , ,

Android Get Width And Height Of Image From Resource

In Android to get the width and height of an image from your res folder do the following: BitmapDrawable bd = (BitmapDrawable) this.getResources().getDrawable(R.drawable.icon); int height = bd.getBitmap().getHeight(); int width = bd.getBitmap().getWidth(); If you want the width and height depending the target

Tagged with: , ,

Android Can’t Find File android_winusb.inf

The android_winusb.inf file is in a subfolder of the Android SDK directory, specifically: ..\android-sdk\extras\google\usb_driver\android_winusb.inf In older version of the sdk it was in ..\android-sdk\usb_driver\android_winusb.inf Depending on the installation and updates you might have both. The file in extras is the

Tagged with: , ,

Windows 8 Android HTC Desire HD Developer

HTC Sync is not compatible with Windows 8 yet. This include not being able to debug and develop on your HTC Desire HD mobil and possible most of HTC mobiles. HTC One, Sensation, Magic and more. Eventhough you have enabled USB debugging.

Tagged with: ,

Android Calculate Time Between Two

  Use a Date object: Date interestingDate = new Date(); You can find the different in milliseconds between the actual current date and interestingDate by doing: long time = (new Date()).getTime() – interestingDate.getTime()  

Tagged with: ,

Android Follow Test Method Naming Conventions

When naming test methods, you can use an underscore to separate what is being tested from the specific case being tested. This style makes it easier to see exactly what cases are being tested. For example: testMethod_specificCase1 testMethod_specificCase2 void testIsDistinguishable_protanopia() { ColorMatcher

Tagged with: ,