Category Archives: Android

Android – Set max length of logcat messages

Questions: By default, it seems that logcat will truncate any log message that it considers to be “too long”. This happens both inside of Eclipse and when running logcat on the command line using adb -d logcat, and is truncating some important debugging messages. Is there any way to increase the maximum string length supported… Read More »

Android: set view style programmatically

Questions: Here’s XML: <RelativeLayout xmlns:android=”http://schemas.android.com/apk/res/android” style=”@style/LightStyle” android:layout_width=”fill_parent” android:layout_height=”55dip” android:clickable=”true” android:orientation=”horizontal” > <LinearLayout android:layout_width=”match_parent” android:layout_height=”match_parent” android:orientation=”horizontal” /> </RelativeLayout> How to set style attribute programmatically? Answers: Technically you can apply styles programmatically, with custom views anyway: private MyRelativeLayout extends RelativeLayout { public MyRelativeLayout(Context context) { super(context, null, R.style.LightStyle); } } The one argument constructor is the one… Read More »

Update Android Support Library to 23.2.0 cause error: XmlPullParserException Binary XML file line #17<vector> tag requires viewportWidth > 0

Questions: I try to update my Support Library up to 23.2.0 and face this error: Exception while inflating <vector> org.xmlpull.v1.XmlPullParserException: Binary XML file line #17<vector> tag requires viewportWidth > 0 at android.support.graphics.drawable.VectorDrawableCompat.updateStateFromTypedArray(VectorDrawableCompat.java:535) at android.support.graphics.drawable.VectorDrawableCompat.inflate(VectorDrawableCompat.java:472) at android.support.graphics.drawable.VectorDrawableCompat.createFromXmlInner(VectorDrawableCompat.java:436) at android.support.v7.widget.AppCompatDrawableManager$VdcInflateDelegate.createFromXmlInner(AppCompatDrawableManager.java:829) at android.support.v7.widget.AppCompatDrawableManager.loadDrawableFromDelegates(AppCompatDrawableManager.java:303) at android.support.v7.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:178) at android.support.v7.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:173) at android.support.v7.widget.TintTypedArray.getDrawable(TintTypedArray.java:60) at android.support.v7.widget.Toolbar.<init>(Toolbar.java:254) at android.support.v7.widget.Toolbar.<init>(Toolbar.java:196) at java.lang.reflect.Constructor.constructNative(Native Method) at java.lang.reflect.Constructor.newInstance(Constructor.java:417)… Read More »

ListView OnItemClickListener Not Responding?

Questions: I’ve looked everywhere for a solution to this, but I can’t figure out how to implement it. My OnItemClickListener was disabled somehow on my ListView rows, because I have an ImageButton in the row layout, which takes over the focus. There have been numerous questions I’ve found, but none of them have gotten me… Read More »

Google In-App billing, IllegalArgumentException: Service Intent must be explicit, after upgrading to Android L Dev Preview

Questions: My in-app billing code was working fine until I upgraded to the Android L Dev Preview. Now I get this error when my app starts. Does anyone know what’s changed about L that causes this or how I should change my code to fix this? android { compileSdkVersion ‘android-L’ buildToolsVersion ’20’ defaultConfig { minSdkVersion… Read More »

Android background image size in pixel

Questions: I would like to create a background image for different resolutions in Android. So I need the values (in pixel) for ldpi, mdpi, hdpi,xhdpi and xxhdpi. It is important that the image will not be blurred. I have already read the Documentation about multiple screen support but there are sizes in dp instead of… Read More »

java.lang.ClassNotFoundException: Didn't find class on path: dexpathlist

Questions: I’m currently working on a project in which I have to use purely native ndk. It worked when I try running an helloworld example from Irrlicht engine source. Then I try using it in my project following the same format of that example. But I got: 03-14 01:40:05.308: E/AndroidRuntime(799): java.lang.RuntimeException: Unable to instantiate activity… Read More »

Creating a button in Android Toolbar

Questions: How can I create a button inside Android’s Toolbar that looks like this iOS example? Answers: ToolBar with Button Tutorial 1 – Add library compatibility inside build.gradle dependencies { compile fileTree(dir: ‘libs’, include: [‘*.jar’]) compile ‘com.android.support:appcompat-v7:21.0.3’ } 2 – Create a file name color.xml to define the Toolbar colors <?xml version=”1.0″ encoding=”utf-8″?> <resources> <color… Read More »