Close
0

Android Code to get Device’s Battery Status

Visitor’s Views: 268 Step 1: Create Project in Android Studio and Put Following code  in your xml file    <?xml version=”1.0″ encoding=”utf-8″?> <RelativeLayout xmlns:android= “http://schemas.android.com/apk/res/android” xmlns:tools= “http://schemas.android.com/tools” android:id=”@+id/activity_main” android:layout_width=”match_parent” android:layout_height=”match_parent” android:padding=”30dp” > <TextView android:id=”@+id/textViewBatteryStatus” android:layout_width=”wrap_content” android:layout_height=”wrap_content” android:layout_centerHorizontal=”true” android:layout_centerVertical=”true” android:text=”Current Battery Status” android:textAppearance=”?android:attr/textAppearanceLarge” /> <Button android:id=”@+id/buttonBatteryStatus” android:layout_width=”wrap_content” android:layout_height=”wrap_content” android:layout_below=”@+id/textViewBatteryStatus” android:layout_centerHorizontal=”true” android:layout_marginTop=”16dp” android:visibility=”gone” android:text=”Click here to Get Continue Reading

1

Pie Chart – Android

Visitor’s Views: 196 Step 1: Add dependency to build.gradle (Module app) compile ‘com.github.PhilJay:MPAndroidChart:v2.2.2’ Step 2:Add following lines in Your Xml file <com.github.mikephil.charting.charts.PieChart android:id=”@+id/chart1″ android:layout_width=”300dp” android:layout_height=”300dp” android:layout_margin=”5dp” /> Step 3: Write the Java code in Your Activity package com.gayatrisoft.sip_calculator; import android.graphics.Color; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; public class Pie_chart extends AppCompatActivity { PieChart piechart; private int[] number_of_members Continue Reading

1

Android Application Heap Size..

Visitor’s Views: 205 Add more memory for heap size problem. Soution – Add in Gradle “Module : app” dexOptions { javaMaxHeapSize “2048M” } Example: android { dexOptions { javaMaxHeapSize “2048M” } compileSdkVersion 25 buildToolsVersion “25.0.2” defaultConfig { applicationId “s3.demo_map_navigation” minSdkVersion 15 targetSdkVersion 25 versionCode 1 versionName “1.0” testInstrumentationRunner “android.support.test.runner.AndroidJUnitRunner” } buildTypes { release { minifyEnabled Continue Reading