How To Build An Android Bill Reminder App To Remember Paying Bills - Hive Programmers

avatar

Greetings to my favorite science community online, StemSocial.

It's @skyehi and I'm absolutely excited to be back to continue my series on Android App Development Tutorials for beginners.

I hope everyone enjoyed the Christmas holidays. It's Christmas and it's a time where usually most people spend a lot of money on gifts and that kinda raise their bills up for that particular month.

This happened to a couple of my friends and they don't necessarily complain about it because it's Christmas so it's totally worth it.

However that got me thinking about Bill reminder Apps. I believe having an App that conveniently reminds the user of unpaid bills is a perfect tool to help anyone stay within budget every single month.

Polish_20231226_151636796.jpgOriginal Image Source by Pixabay from Pexels

YpihifdXP4WNbGMdjw7e3DuhJWBvCw4SfuLZsrnJYHEpsqZFkiGGNCQTayu6EytKdg7zA3LL2PbZxrJGpWk6ZoZvBcJrADNFmaFEHagho8WsASbAA8jrpnELSvRtvjVuMiU1C5ADFX1vJgcpDvNtue9Pq83tjBKX62dqT5UoxtDk.png

Sometimes, we tend to forget certain bills or money we owe and that can really mess up our budget at the end of each month so that's why I believe it was very necessary to add this particular type of App to my series.

I've said this countless of times, building very useful Apps increases your chances of success as a developer and also increases the demand for your programming services by customers.

However guys, since this is still a beginner's guide and I intend to keep it simple, we'll only build a model of the App and not the entire project.

So guys for today's app project we'll focus on the main activity, database setup, and bill addition functionality.

If I had to build an entire project I really don't think you'd be able to finish reading it right now😂 but actually when we get to advanced level of this series we'll build complete Apps so stay tuned guys.

Prerequisites

As always guys please ensure that before you start this tutorial, you have both Android Studio IDE and Java Development Kit, JDK installed on your PC.

If you're having trouble installing any of the softwares, please let me know in the comments guys.

2dk2RRM2dZ8gKjXsrozapsD83FxL3Xbyyi5LFttAhrXxr16mCe4arfLHNDdHCBmaJroMz2VbLrf6Rxy9uPQm7Ts7EnXL4nPiXSE5vJWSfR53VcqDUrQD87CZSpt2RKZcmrYrze8KanjkfyS8XmMCcz4p33NZmfHE4S9oRo3wU2.png

Setting Up Our Android Project

Let's start our work by opening Android Studio and clicking on "Create a New Android Project".

We're still going to choose "Empty Activity" as the template of our App project. Click on the next button and set the App name and package name of your App.

I think I've made mention of this before; a good and unique App name is necessary to ensure the success of your App.

When users browse through the App store and see a unique and catchy name of your App, they get very interested.

So if you're planning on building your very own Apps and publish on the app store, I'll encourage you to always pick unique catchy names that stand out.

Also, we're going to keep using Java programming language for our tutorial series so please ensure that Java is selected as programming language and not Kotlin.

When you're satisfied with the project configuration, click on the finish button and wait for Android Studio to prepare your App Project.

YpihifdXP4WNbGMdjw7e3DuhJWBvCw4SfuLZsrnJYHEpsqZFkiGGNCQTayu6EytKdg7zA3LL2PbZxrJGpWk6ZoZvBcJrADNFmaFEHagho8WsASbAA8jrpnELSvRtvjVuMiU1C5ADFX1vJgcpDvNtue9Pq83tjBKX62dqT5UoxtDk.png

Now the first thing we're going to work on is the design layout. However, here's how your MainActivity.java which is where the main backend code of your App will be written should look like.

package com.example.billreminder;

import android.os.Bundle;
import androidx.appcompat.app.AppCompatActivity;

public class MainActivity extends AppCompatActivity {
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
    }
}

If you chose Kotlin in your App configuration, it would be the same code setup but in Kotlin language instead.

YpihifdXP4WNbGMdjw7e3DuhJWBvCw4SfuLZsrnJYHEpsqZFkiGGNCQTayu6EytKdg7zA3LL2PbZxrJGpWk6ZoZvBcJrADNFmaFEHagho8WsASbAA8jrpnELSvRtvjVuMiU1C5ADFX1vJgcpDvNtue9Pq83tjBKX62dqT5UoxtDk.png

Designing Our App User Interface

Alright guys, hopefully after your project successfully builds and everything seems to work just fine, we're going to start working on the design layout of our app.

It's the main frontend and the part of the App the users see and interacts with. Since it's a basic model, I'm not going to add any specific design or layout.

I'm only showing the steps a programmer would take to build the entire Bill Reminder App.

Obviously your app would have editText for adding bills and each bill can have an alarm set for it which would notify the user of unpaid bills.

There would definitely be a Button element the user would click to create a new bill and set the alarm and also a checkBox which would check if a Bill payment is made or not.

So you'll have to work on all of that inside theres/layout/activity_main.xml:

The structure should look something like this

<?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:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity">

    (html comment removed:  UI elements go here )

</RelativeLayout>

Where I placed the UI elements go here is where your editText, button and checkbox would go.

Since it's a list of bill payments, you'd probably require a RecycleView element to display the list, a class to hold the data like Bill amount, name and even currency if you want to.

After building the class you also want to build a RecycleView adapter class to bind items to the RecyclerView.

You would also need to create an item layout which would show the design of each item in your RecycleView.

The interesting thing is that if you've been following my tutorials for over a month, you'd be skipping this part of the blog because you're probably used to it and you know what to do😎. If you did that, I'm totally proud of you 😂.

YpihifdXP4WNbGMdjw7e3DuhJWBvCw4SfuLZsrnJYHEpsqZFkiGGNCQTayu6EytKdg7zA3LL2PbZxrJGpWk6ZoZvBcJrADNFmaFEHagho8WsASbAA8jrpnELSvRtvjVuMiU1C5ADFX1vJgcpDvNtue9Pq83tjBKX62dqT5UoxtDk.png

Database Setup

Now guys since we'll need to store the bill data and I'm pretty sure you don't want to lose your bill Data and forget the fact that you have bills, we certainly need a database system.

We'll have to integrate SQLite database for storing bill data. You should create an entire separate Java class for this step. You can call it BillDatabaseHelper.java

This is a new default class I'm introducing in this series and it's the SQLiteDatabase class. It's very easy to use for any App that would require storing user data.

Here's a model of how your database class should look like

package com.example.billreminder;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

public class BillDatabaseHelper extends SQLiteOpenHelper {
    private static final String DATABASE_NAME = "billreminder.db";
    private static final int DATABASE_VERSION = 1;

    // Table creation SQL statement
    private static final String TABLE_CREATE =
            "CREATE TABLE bills (_id INTEGER PRIMARY KEY AUTOINCREMENT, "
                    + "name TEXT, due_date TEXT, amount REAL);";

    public BillDatabaseHelper(Context context) {
        super(context, DATABASE_NAME, null, DATABASE_VERSION);
    }

    @Override
    public void onCreate(SQLiteDatabase db) {
        db.execSQL(TABLE_CREATE);
    }

    @Override
    public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
        // Upgrade policy goes here
    }
}

YpihifdXP4WNbGMdjw7e3DuhJWBvCw4SfuLZsrnJYHEpsqZFkiGGNCQTayu6EytKdg7zA3LL2PbZxrJGpWk6ZoZvBcJrADNFmaFEHagho8WsASbAA8jrpnELSvRtvjVuMiU1C5ADFX1vJgcpDvNtue9Pq83tjBKX62dqT5UoxtDk.png

Handling Notifications

Remember I said that our App would probably need a way to notify the user of unpaid bills? We'll need to also write the code to implement a notification service for our Bill Reminder App.

We'll also have to create an entirely new java class for this step and it would definitely require some Android Manifest permission requests.

So you can create a java class and perhaps name it NotificationService.javato implement notification service in the App.

Here's how the notification service code would look like

package com.example.billreminder;

import android.app.IntentService;
import android.content.Intent;

public class NotificationService extends IntentService {
    public NotificationService() {
        super("NotificationService");
    }

    @Override
    protected void onHandleIntent(Intent intent) {
        // Notification logic goes here
    }
}

Managing Bill

Then you come to the main Logic of your App which would require adding Bills in the App. This may take a similar approach to adding new notes in a notepad App but would include the amount, the currency and also a way to track how much the user has paid so far versus the total bill and what's left to pay.

You would definitely need to create a whole new activity which would include a frontend layout design and a backend code. You can call that activity classAddBillActivity.java

When you create the new activity, it would look like this

package com.example.billreminder;

import android.os.Bundle;
import androidx.appcompat.app.AppCompatActivity;

public class AddBillActivity extends AppCompatActivity {
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_add_bill);
    }
}

Requesting Permission

Alright guys, lastly you wouldn't want to forget about adding all the permissions that your App would need to access the various services.

Since our App would probably have an alarm system, the alarm permission will be added, also SQL database permissions is needed, the read and write internal and external storage permission will also be added and finally we'll add some notification permissions as well.

Of course all this should be done inside your AndroidManifest file

Here's how the permission codes should look like

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.billreminder">

    (html comment removed:  Permissions for accessing the device's alarm manager for notifications )
    <uses-permission android:name="com.android.alarm.permission.SET_ALARM" />

    (html comment removed:  Permissions for accessing the device's storage to read and write data )
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

    (html comment removed:  Permissions for accessing the device's SQLite database )
    <uses-permission android:name="android.permission.WRITE_INTERNAL_STORAGE" />

    (html comment removed:  Permissions for receiving and handling notifications )
    <uses-permission android:name="android.permission.VIBRATE" />
    <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />

    (html comment removed:  Add any other permissions based on additional features your app may include )

    <application
        ...
    </application>
</manifest>

2dk2RRM2dZ8gKjXsrozapsD83FxL3Xbyyi5LFttAhrXxr16mCe4arfLHNDdHCBmaJroMz2VbLrf6Rxy9uPQm7Ts7EnXL4nPiXSE5vJWSfR53VcqDUrQD87CZSpt2RKZcmrYrze8KanjkfyS8XmMCcz4p33NZmfHE4S9oRo3wU2.png

So guys this is a complete model of a bill Reminder App. This should definitely give any programmer an idea of the steps or what you'll need to do to be able to build this App.

Always remember that practicing with these Apps is the right way to build your experience as an App developer.

Thank you so much for taking the time to read today's blog. I hope you enjoyed this one guys.

As always if you're finding difficulties understanding any of the concepts or installing any software, please let me know in the comments and I'll be happy to respond.

Have a lovely day and catch you next time on StemSocial. Goodbye 👨‍💻


You Can Follow Me @skyehi For More Like This And Others



0
0
0.000
3 comments
avatar

are you working for a certain company? because you are so pro with java and making apps quickly :D

0
0
0.000
avatar

Well I built a lot of my own apps in the past but realized that the kind of App i want to build would require investments in servers and database so I out a hold on it.

However I'll be working on a lot of Apps in 2024. When I release it I'll talk all about it on Hive and perhaps find a way to make some DAPPS too.

At the moment, I love blogging as well which is why Hive is my home.

0
0
0.000
avatar

Thanks for your contribution to the STEMsocial community. Feel free to join us on discord to get to know the rest of us!

Please consider delegating to the @stemsocial account (85% of the curation rewards are returned).

Thanks for including @stemsocial as a beneficiary, which gives you stronger support. 
 

0
0
0.000