Facebook Twitter Instagram
    DeepCrazyWorld
    Facebook Twitter Instagram Pinterest YouTube
    • FLUTTER
      • FLUTTER APP
        • QRCode
        • Quiz App
        • Chat GPT
        • PDF App
        • News App
        • Fitness App
        • Weather App
        • BMI Calculator
        • GAME APP
        • Ecommerce App
        • wallpaper App
        • Finance app
        • Chat App
        • Wallet App
        • Taxi App
        • Quran app
        • Music player app
      • FLUTTER UI
        • Splash Screen
        • Onboarding Screen
        • Login Screen
        • Card Design
        • Drawer
    • PROJECT
      • Android Projects
      • College Projects
      • FLUTTER APP
      • Project Ideas
      • PHP Projects
      • Python Projects
    • SOURCE CODE
    • ANDROID
      • ANDROID APP
      • GAME APP
      • ANDROID STUDIO
    • MCQ
      • AKTU MCQ
        • RPA MCQ
        • COA MCQ
        • HPC MCQ
        • SPM MCQ
        • Renewable Energy All MCQ
        • Data Compression MCQ
        • Data Structure MCQ
        • Digital Image Processing MCQ
        • Software Engineering MCQ
        • Machine Learning MCQ
        • Artificial Intelligence MCQ
      • D PHARMA MCQ
        • Pharmaceutics – I MCQ
        • Pharmacognosy MCQ
        • Pharmaceutical Chemistry MCQ
        • Biochemistry and Clinical Pathology MCQ
        • Human Anatomy and Physiology MCQ
        • Heath Education and Community Pharmacy MCQ
    • INTERVIEW QUESTIONS
      • Flutter Interview Questions
      • INTERVIEW QUESTIONS
      • Python Interview Questions
      • Coding ninjas solution
    • MORE
      • WORDPRESS
        • SEO
        • TOP 10 WORDPRESS THEME
      • PRODUCTIVITY
      • Program
      • QUOTES
    DeepCrazyWorld
    Home»ANDROID APP»How to Make BarChart Graph in Android Studio with source code
    ANDROID APP

    How to Make BarChart Graph in Android Studio with source code

    DeepikaBy DeepikaOctober 5, 2020Updated:January 20, 2022No Comments3 Mins Read

    BarChart Graph – How to Make BarChart Graph in Android Studio with source code. scanner Application in android studio , how to make bar chart graph.

    Table of Contents

    Toggle
    • MainActivity.Java
    • activity_main.xml
    • colors.xml
    • style.xml
    • String.xml
    • Add Dependency
    • build.gradle(module: app)
    • build.gradle
    • YOUTUBE VIDEO
    • Manifest File
    • BarCharts Graph App Full source code
        • BarChart Application APK Download – CLICK HERE
    • READ MORE ANDROID APPS
    • READ MORE

    MainActivity.Java

    package com.developer.technic.barchartgraph;
    
    import androidx.appcompat.app.AppCompatActivity;
    
    import android.graphics.Color;
    import android.os.Bundle;
    
    import com.github.mikephil.charting.charts.BarChart;
    import com.github.mikephil.charting.data.BarData;
    import com.github.mikephil.charting.data.BarDataSet;
    import com.github.mikephil.charting.data.BarEntry;
    import com.github.mikephil.charting.utils.ColorTemplate;
    
    import java.util.ArrayList;
    
    public class MainActivity extends AppCompatActivity {
    
        BarChart barChart;
        BarData barData;
        BarDataSet barDataSet;
        ArrayList barEntries;
        @Override
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.activity_main);
            barChart = findViewById(R.id.barChart);
    
            getEntries();
    
            barDataSet = new BarDataSet(barEntries,"Data Set");
            barData = new BarData(barDataSet);
    
            barChart.setData(barData);
    
            barDataSet.setColors(ColorTemplate.MATERIAL_COLORS);
            barDataSet.setValueTextColor(Color.BLACK);
            barDataSet.setValueTextSize(16f);
    
    
    
        }
    
    
        private void getEntries(){
    
            barEntries = new ArrayList<>();
            barEntries.add(new BarEntry(1f,2));
            barEntries.add(new BarEntry(2f,4));
            barEntries.add(new BarEntry(3f,1));
            barEntries.add(new BarEntry(5f,5));
            barEntries.add(new BarEntry(6f,3));
            barEntries.add(new BarEntry(7f,2));
    
    
        }
    
    
    }
    
    <img decoding=

    activity_main.xml

    <?xml version="1.0" encoding="utf-8"?>
    <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:app="http://schemas.android.com/apk/res-auto"
        xmlns:tools="http://schemas.android.com/tools"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:padding="10dp"
        tools:context=".MainActivity">
    
        <com.github.mikephil.charting.charts.BarChart
            android:id="@+id/barChart"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            />
    </androidx.constraintlayout.widget.ConstraintLayout>

    colors.xml

    <?xml version="1.0" encoding="utf-8"?>
    <resources>
        <color name="colorPrimary">#EF5350</color>
        <color name="colorPrimaryDark">#EF5350</color>
        <color name="colorAccent">#D81B60</color>
    </resources>
    

    style.xml

    <resources>
    
        <!-- Base application theme. -->
        <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
            <!-- Customize your theme here. -->
            <item name="colorPrimary">@color/colorPrimary</item>
            <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
            <item name="colorAccent">@color/colorAccent</item>
        </style>
    
    </resources>
    

    String.xml

    <resources>
        <string name="app_name">BarChart Graph</string>
    </resources>
    

    Add Dependency

      implementation 'com.github.PhilJay:MPAndroidChart:v3.1.0'

    build.gradle(module: app)

    apply plugin: 'com.android.application'
    
    android {
        compileSdkVersion 30
        buildToolsVersion "29.0.2"
        defaultConfig {
            applicationId "com.developer.technic.barchartgraph"
            minSdkVersion 21
            targetSdkVersion 30
            versionCode 1
            versionName "1.0"
            testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
        }
        buildTypes {
            release {
                minifyEnabled false
                proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
            }
        }
    }
    
    dependencies {
        implementation fileTree(dir: 'libs', include: ['*.jar'])
        implementation 'androidx.appcompat:appcompat:1.1.0'
        implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
        testImplementation 'junit:junit:4.12'
        androidTestImplementation 'androidx.test.ext:junit:1.1.1'
        androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
        implementation 'com.github.PhilJay:MPAndroidChart:v3.1.0'
    
    }
    

    build.gradle

    // Top-level build file where you can add configuration options common to all sub-projects/modules.
    
    buildscript {
        repositories {
            google()
            jcenter()
            
        }
        dependencies {
            classpath 'com.android.tools.build:gradle:3.5.3'
            
            // NOTE: Do not place your application dependencies here; they belong
            // in the individual module build.gradle files
        }
    }
    
    allprojects {
        repositories {
            google()
            jcenter()
            maven { url 'https://jitpack.io' }
    
        }
    }
    
    task clean(type: Delete) {
        delete rootProject.buildDir
    }
    

    YOUTUBE VIDEO

    Manifest File

    <?xml version="1.0" encoding="utf-8"?>
    <manifest xmlns:android="http://schemas.android.com/apk/res/android"
        package="com.developer.technic.barchartgraph">
    
        <application
            android:allowBackup="true"
            android:icon="@drawable/barchart"
            android:label="@string/app_name"
            android:roundIcon="@mipmap/ic_launcher_round"
            android:supportsRtl="true"
            android:theme="@style/AppTheme">
            <activity android:name="com.developer.technic.barchartgraph.MainActivity">
                <intent-filter>
                    <action android:name="android.intent.action.MAIN" />
    
                    <category android:name="android.intent.category.LAUNCHER" />
                </intent-filter>
            </activity>
        </application>
    
    </manifest>

    BarCharts Graph App Full source code

    BarChart Application APK Download – CLICK HERE

    Get Full Source Code

    READ MORE ANDROID APPS

    • Wallpaper Android App- CLICK HERE
    • All IN ONE Status Saver App – CLICK HERE
    • Photo Video Maker Android App – CLICK HERE
    • Video Downloader Android App – CLICK HERE
    • College Student Portal System App – CLICK HERE
    • Call Recorder Android App – CLICK HERE
    • PDF Reader App with firebase – CLICK HERE
    • ShareIt Clone App – CLICK HERE
    • PDF E-Book App with Firebase – CLICK HERE

    ShareTweetShare

    READ MORE

    Share. Facebook Twitter LinkedIn WhatsApp Telegram Pinterest Reddit Email
    Previous ArticleHow to Make ShareIt Clone App | Ultimate Transfer & Share Files
    Next Article Native Android Pdf E-Books App with Firebase Back-end

    Related Posts

    Music player app in flutter and dart using node.js music API

    ANDROID APP 2 Mins Read

    How to create Simple movie app with Source code 2023

    ANDROID APP 4 Mins Read

    Scratch to Win Android Earning App (Admob, FB Ads, StartApp, Unity Ads)

    ANDROID APP 2 Mins Read

    Covid-19 Tracker App(Coronavirus Tracker) source code 2023

    ANDROID APP 3 Mins Read

    Leave A Reply Cancel Reply

    Recent Posts
    • Implementing a Dynamic FAQ Screen UI in Flutter Using ExpansionTile March 29, 2025
    • Creating an Instruction UI Screen in Flutter Application March 29, 2025
    • Animated Backgrounds in Flutter: A Complete Guide March 15, 2025
    • How to make Diary App using flutter stepwise using getx August 31, 2024
    • How to Create Music Player UI screen with fully functional in flutter August 30, 2024
    • How to make ListView Builder Ui in flutter with Source Code August 29, 2024
    • Create a TabBar View in flutter with fully functional stepwise August 28, 2024
    • How to create TabBar view in flutter with source code step wise August 27, 2024
    • How to make Heart rate measure app with Flutter stepwise August 26, 2024
    • How to make ChatGpt App in flutter with source code Stepwise August 25, 2024
    Facebook Twitter Instagram Pinterest YouTube
    • About
    • Contact
    • Disclaimer
    • Privacy Policy
    Copyright by DeepCrazyWorld © 2025

    Type above and press Enter to search. Press Esc to cancel.