Showing posts with label Android L. Show all posts
Showing posts with label Android L. Show all posts

Tuesday, 6 February 2018

Android UI and Inflate Exception

Error : Inflate Exception : Binary xml .....


I can't say how frequently you guys face this error but when it occurs surely takes quite time.

Whenever one face such an exception, the greatest possibility is with the child view not being able to initialize correctly which could be due to the following reasons :



1. The layout file must be including some CustomView which is not being correctly referenced or sometimes if it is referenced, there could be some error with in the implementation (one reason of which could be the absence of constructor with attribute set, theme etc.)


2. If you think that case one is checked, then please check once for the view that causes the inflation failure. Need to check if the drawing is successful for that view.

You will get the easiest reasons quickly but one of the most elusive causal reason is the error in background drawable which may or may not give error at compile time.

So little digging is required here.

Tuesday, 23 June 2015

Issues with Animators


What are animators ? Why do we need them ? What is the difference with the conventional view animations ? How animators are implemented in android ?


Well today in this post I will not talk about these, instead I will put light on some issues that I faced while working and came to know about the reason very late.

The main issues that I noticed are :

1. I cannot reuse an ObjectAnimator and AnimatorSet object to get it usable for multiple views.
2. I cannot clear animation from my view. I mean resetting the view to its original position.

So after delving deeply into the android developer docs I reached to the following solutions at the time of writing :

1. Clone the create ObjectAnimator and AnimatorSet object to create a completely different copy of that object which could be used easily with a new view.
2. To get the reset functionality for animator set, we should be creating an animator that animates the same property to back to its original state(reverse action of the animator).


Please comment in case of issues :

Monday, 27 October 2014

Gradle Configuration for an Android Studio project with Android 5.0 or L or Lollipop

This post is only about configuring an android project in Android Studio with compile and target versions set as  android L or 5.0 or Lollipop. 

    I am writing this post with the sample gradle as I faced a lot of problems while configuring Lollipop's preview version.
    I will write the sample gradle as well as the screen shot of android sdk manager to represent most basic requirements required for a project setup with target version as Lollipop.
   
    So to be able to use any feature of the Android 5.0, here is the sample gradle with support library for Android L features :



apply plugin: 'com.android.application'

android {
    compileSdkVersion 21
    buildToolsVersion "21.0.1"

    defaultConfig {
        applicationId "your app's packagename"
        minSdkVersion 10
        targetSdkVersion 21
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            runProguard false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:21.0.+'
 // Not compulsory just added 
    compile 'com.google.android.gms:play-services:+'
 // Support for L features for devices with lower OS versions
    compile 'com.android.support:cardview-v7:21.0.+'
    compile 'com.android.support:recyclerview-v7:21.0.+'
}

Also see the following attached screenshots to get the required SDK, various support dependencies, platforms etc to be downloaded :

Android Tools :


Android SDK 5.0(L or Lollipop)

 Minimum Android SDK (as per above gradle 2.3.3 or API level 10)

Support Libraries for L features for older devices

Please provide your comment in case of any issues.