Friday, November 6, 2020

Calculator Android App | Android Studio | Full Project With Source Code | Download .apk File on Phone

In this Post, I have Managed to Build a Calculator Using Android Studio. This is a Basic Calculator Which Performs Several Function.

It is a little bit comlex, so if you are not a Android Developer then You Should Download the .apk File of this App to Use this in your Android Device

About this App :-

This is a Calculator which is designed and developed by me which performs several Calculations like Addition, Substraction, Multiplication, Division, etc. It has Also a About Page Which Contains an Awesome Audiowide Font Look. I builded the app with a dark theme. So if you want Light theme, then simply change the colours.xml File to Make it light theme. This app also has a menu bar. The buttons of this are modern looking awesome designed buttons. So if you like it, then Please Comment Down Below :)

Want to Install It without Android Studio In your Phone, Download from the link :-

For Those, who want to Build OwnSelf :-

How to Use :-

First of all Open Android Studio and Create a New Empty Project, After that wait for the Gradle to Complete Building. After that, Open your project's res folder manually and then delete all the folders inside it. Now Download the Import Files from the Button Given Below and then Extract it using WinRar. After Extracting, Cut the Folders that are formed after Extracting and Paste them Inside your res Folder. Now Copy the MainActivity.java Code From Below and Open your MainActivity.java file and Paste the Code there.Now Create One More Java File where your MainActivity.java exists, and name the File as About_Us.java. After that, Copy the About_us.java code from below and Paste it inside the About_Us.java file. After that, create a New Java File Where you created the previous one, and name it as About_Us_Info.java. Now Copy the About_Us_Info.java Code from below and Paste it inside your About_Us_Info.java file. Now you can run the App :)

First of all Download The Files Given Below and replace it with the files in the "res" Folder of your Project, Like Shown in the Image Below

[MainActivity.java] Source Code :-


package com.macstockofficial.kunalimagestopdfconv;

import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;


import androidx.fragment.app.Fragment;
import androidx.viewpager.widget.ViewPager;
import androidx.appcompat.app.AppCompatActivity;

import android.text.Layout;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;

import android.os.Bundle;



public class MainActivity extends AppCompatActivity {
    Button btn1, btn2, btn3, btn4, btn5, btn6, btn7, btn8, btn9, btn0, btnAdd, btnMultiply, btnDiv, btnMinus, btnDot, btnEqual;
    Button btnClear;
    EditText ed1;
    Float result1, result2;
    boolean Add, Sub, Multiply, Divide;

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        MenuInflater menuInflater = getMenuInflater();
        menuInflater.inflate(R.menu.menu, menu);
        return true;
    }


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);


        btn1 = (Button) findViewById(R.id.btn1);
        btn2 = (Button) findViewById(R.id.btn2);
        btn3 = (Button) findViewById(R.id.btn3);
        btn4 = (Button) findViewById(R.id.btn4);
        btn5 = (Button) findViewById(R.id.btn5);
        btn6 = (Button) findViewById(R.id.btn6);
        btn7 = (Button) findViewById(R.id.btn7);
        btn8 = (Button) findViewById(R.id.btn8);
        btn9 = (Button) findViewById(R.id.btn9);
        btn0 = (Button) findViewById(R.id.btn0);
        btnAdd = (Button) findViewById(R.id.btnAdd);
        btnMinus = (Button) findViewById(R.id.btnMinus);
        btnMultiply = (Button) findViewById(R.id.btnMultiply);
        btnDiv = (Button) findViewById(R.id.btnDiv);
        btnDot = (Button) findViewById(R.id.btnDot);
        btnEqual = (Button) findViewById(R.id.btnEqual);
        btnClear = (Button) findViewById(R.id.btnClear);
        ed1 = (EditText) findViewById(R.id.editTextTextPersonName);

        btn1.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                ed1.setText(ed1.getText()+ "1");
            }
        });

        btn2.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                ed1.setText(ed1.getText()+ "2");
            }
        });

        btn3.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                ed1.setText(ed1.getText()+ "3");
            }
        });

        btn4.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                ed1.setText(ed1.getText()+ "4");
            }
        });

        btn5.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                ed1.setText(ed1.getText()+ "5");
            }
        });

        btn6.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                ed1.setText(ed1.getText()+ "6");
            }
        });

        btn7.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                ed1.setText(ed1.getText()+ "7");
            }
        });

        btn8.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                ed1.setText(ed1.getText()+ "8");
            }
        });

        btn9.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                ed1.setText(ed1.getText()+ "9");
            }
        });

        btn0.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                ed1.setText(ed1.getText()+ "0");
            }
        });

        btnDot.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                ed1.setText(ed1.getText()+ ".");
            }
        });


        btnAdd.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                if (ed1==null){
                    ed1.setText("");
                }
                else{
                    result1 = Float.parseFloat(ed1.getText() + "");
                    Add = true;
                    ed1.setText(null);
                }
            }
        });
        btnMinus.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                if (ed1==null){
                    ed1.setText("");
                }
                else{
                    result1 = Float.parseFloat(ed1.getText() + "");
                    Sub = true;
                    ed1.setText(null);
                }
            }
        });

        btnMultiply.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                if (ed1==null){
                    ed1.setText("");
                }
                else{
                    result1 = Float.parseFloat(ed1.getText() + "");
                    Multiply = true;
                    ed1.setText(null);
                }
            }
        });

        btnDiv.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                if (ed1==null){
                    ed1.setText("");
                }
                else{
                    result1 = Float.parseFloat(ed1.getText() + "");
                    Divide = true;
                    ed1.setText(null);
                }
            }
        });

        btnEqual.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                result2 = Float.parseFloat(ed1.getText() + "");
                if (Add==true){
                    ed1.setText(result1 + result2 + "");
                    Add = false;
                }
                if (Sub==true){
                    ed1.setText(result1 - result2 + "");
                    Sub = false;
                }
                if (Multiply==true){
                    ed1.setText(result1 * result2 + "");
                    Multiply = false;
                }
                if (Divide==true){
                    ed1.setText(result1 / result2 + "");
                    Divide = false;
                }
            }
        });
        btnClear.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                ed1.setText("");
            }
        });
    }


    public void about_us(MenuItem menuItem){
        Intent intent = new Intent(this, About_us.class);
        startActivity(intent);
    }


    public void about_us_info(MenuItem menuItem){
        Intent intent = new Intent(this, About_Us_info.class);
        startActivity(intent);
    }




}
    

[About_us.java] Source Code :-


package com.macstockofficial.kunalimagestopdfconv;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;

public class About_us extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_about_us);
    }

    public void subscribe_youtube(View view) {
        Uri uri = Uri.parse("https://www.youtube.com/channel/UCIXud9Ot8pfDQizzdmQ-FyQ?sub_confirmation=1");
        Intent intent = new Intent(Intent.ACTION_VIEW, uri);
        startActivity(intent);
    }

    public void visitweb(View view) {
        Uri uri2 = Uri.parse("https://macstockofficial.blogspot.com/");
        Intent intent2 = new Intent(Intent.ACTION_VIEW, uri2);
        startActivity(intent2);
    }

    public void about_us_info(View view){
        Intent intent = new Intent(this, About_Us_info.class);
        startActivity(intent);
    }
}
    

[About_Us_info.java] Source Code :-


package com.macstockofficial.kunalimagestopdfconv;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;

public class About_Us_info extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_about__us_info);
    }

    public void download_app(View view){
        Uri uri = Uri.parse("https://macstockofficial.blogspot.com/p/my-android-app-download-links-full.html");
        Intent intent = new Intent(Intent.ACTION_VIEW, uri);
        startActivity(intent);
    }
}
    

Hope You Will Like the Project.

Macstock

Author & Editor

Python Programmer and a Simple Web Developer. Owns a Youtube Channel Named MacStock Tech & Gaming and This Website also Refers to him

7 Comments:

  1. I definitely enjoying every little bit of it. It is a great website and nice share. I want to thank you. Good job! You guys do a great blog, and have some great contents. Keep up the good work. Best Coding Android Wallpapers

    ReplyDelete
  2. Your blog has chock-a-block of useful information. I liked your blog's content as well as its look. In my opinion, this is a perfect blog in all aspects. what is iot hidden menu

    ReplyDelete
  3. I was surfing net and fortunately came across this site and found very interesting stuff here. Its really fun to read. I enjoyed a lot. Thanks for sharing this wonderful information. descargar betcris

    ReplyDelete
  4. This is very educational content and written well for a change. It's nice to see that some people still understand how to write a quality post.! codere app

    ReplyDelete
  5. Great Information sharing .. I am very happy to read this article .. thanks for giving us go through info.Fantastic nice. I appreciate this post. http://apkpuress.com/

    ReplyDelete
  6. Admiring the time and effort you put into your blog and detailed information you offer!.. casino caliente app

    ReplyDelete
  7. This is such a great resource that you are providing and you give it away for free. I love seeing blog that understand the value. Im glad to have found this post as its such an interesting one! I am always on the lookout for quality posts and articles so i suppose im lucky to have found this! I hope you will be adding more in the future... casas de apuestas deportivas mexico

    ReplyDelete