DEV Community

cbolanos79
cbolanos79

Posted on

Building an android app using AI

In the last times, AI has become more and more present in our daily lifes, may be acting as an assistan to summarize content, creating content for social media, or as a teacher which help in the process of learning a new language. However, technology suffers limitations, therefore, it is not possible to do evertything just using available tools, despiste there is a wide range of possibilites.
Nowadays, nearly everybody has tried any AI tool like ChatGPT or Dalee, tools which are really useful and interesting, althought there is to take into account all them are privative, which means, they are owned by companies with power to decide when and how to share those tools (subscriptions, free usage limits, etc)
So you may asking yourself why am I talking about AI? Because as an old school software developer, I am curious on how can AI improve my performance and save time, specially when learning a new language or framework. Take into account I have nearly no experience developing modern android apps, nevertheless, I took a look into android development some years ago. You know, there has been a big gap since then!
Here we go: the purpose of this post is to share my impressions about creating an android app using the free tier of ChatGPT, requiring the least possible human intervention. I can advance that the results are good enough, at least for building a simple app from scratch in a short period of time.
So, what is the purpose? I need to log the activity of my dog as the vet needs extended information about her walks (it is not an serious illness), hence, it is a good idea to use an app for this purpose, even though I looked for existing apps and most of them looked too complex, or missed the capability of sharing the information, not to talk about using a simple and straight format.
My requirements are the following:

  • A very simple and straight UI to register activity.
  • There are three kinds of activities: piss, poop and walk.
  • For the piss I need to register the amount, it is valid to store low, medium and high as values.
  • A way to share information with the vet in a straight way, ideally using XLS or CSV format.

Given I would need days or weeks to learn Kotlin and Android development, the time constraint would become a problem, as the information gathered would not be useful, not to talk about spending a lot of resources just to build an unique app, regardless the joy of learning something new.
As a consequence, I tried a different way: what about asking ChatGPT to build an android app feeding the basic requirements? As you may know, using the right prompt is the key for success using LLM AI tools. Let give it a try.
My first prompt was something like this:

Create an android app with four buttons that can store information in a database
One button records that the dog has gone for a walk
Another button records that the dog has peed
Another that the dog has pooped
Each action is recorded in the database with the time of creation
The last button shows a list of the activity, with the name of the action and the time
The last button shows a list
Enter fullscreen mode Exit fullscreen mode

When I saw the result... I was amazed: ChatGPT created the source code for a working app which displayed four fully functional buttons which worked as expected. Just impressive! Obviously, there was room for improvement, specially in UI, as the structure was very simple, but it worked out of the box.
The more I tried the app, the more improvements I found. As you imagine, I requered ChatGPT to include those improvements. Once more, I was amazed with the results: I got not just a way to do anything new, like adding a view to show the activity log, but the updates to codebase to support them. Furthermore, when I requested a new feature or modification, it took into account the existing changes.
You may be thinking I am really excited about using ChatGPT, but this is not the case: I saved a lot of time, I installed a working app in my mobile phone in less than one hour (it took me sometime to download and setup Android Studio), althought, there were some caveats: there were some aspects which I had not information about, like the new way to request permissions on execution time, or how to create a file. Yes, it would be riskfull if I was developing a production ready application, or working for a customer, however, as this a personal project, I have enough room to experiment and dig in some topics.

Here are some screenshoots of the last app version:

Image description

Image description

Image description

Image description

In overall, I consider the AI coverage of app is around 90%, as I just had to modify the initial buttons to use icons, and replace the pee activity suggested by ChatGPT to use a dialog, which I considered more friendly.
Talking about being friendly, under my point of view, this will always be one of the AI caveats: it lacks the capability of interacting with technology like a human. It can not feel the pain of using a bad UI or reject an app because the workflow is complicated, or just because another one is aesthetically pleasant. I firmly belive AI is just a tool, a great tool plenty of knowledge, however, lead by an human.
I would like you all to share your opinnion and experience in comments, specially if you have tried tools like Copilot, and how does it eases your work on daily basis.

If you are curious, here is the source code of the app:

https://github.com/cbolanos79/dog_activity

Top comments (0)