📜 ⬆️ ⬇️

Petrol Meter or my first experience in writing android applications


I want to tell my experience of developing for android.

It all started with the fact that I had an old car and I was wondering how much it was eating gasoline and, accordingly, how much I spend gasoline from point A to point B, and at the end of the summer I got an Android-based phone. The interest in android and the interest in realizing the idea of ​​calculating consumption motivated me to write a simple application.
The essence of the application is quite simple, indicated consumption per 100 km and that's it.
Then we begin our journey, and the program receives the coordinates from the GPS and counts the speed, the distance traveled and the expense.

It turned out this:

image Petrol meter


And now with the problems encountered.

The first thing that was not clear - Where to start?
In general, in principle, where to start?

The answer is quite easy to google and configure. With this, everything was simple.
The problem was with setting up an emulator. The fact is that my Windows username is written in Russian, and the emulator is created in the user folder. But his Russian characters are problematic. As a result, the standard wizard in the eclipse emulator created, but did not run.

I had to google again and finally do it myself, now the hello world was compiled and started on the emulator.
The joy was when I threw it on the phone and it worked there!

The second c encountered
How to design a UI
The answer is not obvious as it seems from the first time.
The fact is that the basic editor in the eclipse was not incomprehensible to me and I couldn’t do something there, I had to design everything with my hands for the first time, but it was tin.

It's good that I found DroidDraw with examples and, lo and behold , I made the interface in 5 minutes. It is simple, elementary, but it is necessary for the beginning.

So thanks to this thing I solved this problem.

Following what was problematic
How to make the transition between windows, how to save and how to work with GPS
I wrote by trial and error, for this, at first, the program often fell out of me, so I became acquainted with Logging and understood the work of the Activity and learned how to make transitions. It was with Activity that I had problems, because I didn’t quite understand the challenge of events in different situations, but seemed to be resolved.

Since my program kept the “mileage”, it was necessary to learn how to save and retrieve data. In this way, I became familiar with the procedure for saving application data.

It’s too bad that there are still few forums on the Internet and few active topics where you could meet and talk with people, but I think this is temporary.

I really liked the work of the android site directory.
Literally 30 minutes after downloading to the market, the program appeared on other sites.
I do not know what kind of increment they give, but the speed itself just amazed me.

Summarizing my story I want to say the following:
It is very cool, when it is possible to realize and use your idea in everyday life, now I know what fuel consumption from home to the store :)
I felt the android, I liked it, maybe I'll do something else.

I want to say the following in advance. The program considers it very average, you can tell if the program considers if I stand in a traffic jam or warm up, I will say: - no. will not be. The program was written for the sake of interest and personal benefit. No claim to accuracy.

Here is a story.

You can download from the market on the trail. QR:

Thanks to all.

Source: https://habr.com/ru/post/105682/

All Articles