Eclipse comes with some hiccup now and then when developing for Android. This error occurred after creating a new project and opening the layout xml file. Failed to convert @drawable/picture into a drawable This is not an error in your code but some strange issue in Eclipse. Restart Eclipse (unfortunately) and the problem will go away.
Tag: Android
Android Wifi and Bluetooth Toggle
The buttons for bluetooth and wifi in the Quick Settings Toggles in Android is not a toggle, it will open the menu in settings for either bluetooth or wifi. However in the newly release version of Android, 4.2.2 you can do a long press to toggle the options. For more information and features:
Android TextView Strike
To make a strike in your TextView in Android use the setPaintFlags like this: TextView tv=(TextView) v.findViewById(android.R.id.text1); tv.setPaintFlags(tv.getPaintFlags() | Paint.STRIKE_THRU_TEXT_FLAG); If you’re using Html.fromHtml to set the text you can’t unfortunately use the <strike> as this is not supported for Android at this moment (in Jelly Bean).
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 becomes even more visible when highlighting a block of text. To fix this you can disable this
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 settings menu, and scroll down to and click “About phone.” Scroll down to the bottom
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.
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
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 an *.out.xml file and the error res\layout\main.xml:0: error: Resource entry main is already defined. To
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 density you can use the intrinsic values: BitmapDrawable bd = (BitmapDrawable) this.getResources().getDrawable(R.drawable.icon); int imageHeight =
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 newest.