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: 197 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