Monday, October 2, 2017

Android Common Code

All the common android code list that used almost every android project.

Here is the list of all code in this post:
  • Support vector drawable
  • PreferenceFragment support
  • Java 8 support
Support vector drawable:
to support vector drawable add below line on the build.gradle file
compile 'com.android.support:support-vector-drawable:26.1.0'
also adds below line on those activities where you use vector drawable.
static {
    AppCompatDelegate.setCompatVectorFromResourcesEnabled(true);
}

PreferenceFragment support:
add the following line on the build.gradle file
compile 'com.android.support:preference-v14:26.1.0'
adds also add below line on the style.XML file
<item name="preferenceTheme">@style/PreferenceThemeOverlay.v14.Material</item>
note: This line is for Material Theme support.

Java 8 support:
to support Java 8 add following line on the build.gradle file
// Keep the following configuration in order to target Java 8.
compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8
}












About Author:

I am Shudipto Trafder,
Since 2015, I write android code. I love to implement new ideas. I use java and also kotlin. Now I am learning Flutter. I love to learn new things and also love to share. And that is the main reason to run this blog.


Let's Get Connected: Facebook Twitter Linkedin Github

No comments :