This design sketch will be very helpful when we are writing our code and need to remember the name of a particular element of our UI.įor good style (and your own sanity!) it’s important to come up with a consistent naming convention for your widgets. For each widget, I’ve labeled their ID property in redand their string resource name in blue. To help us manage all of these details, and to have a clear picture of what we are building in front of us, I’ve sketched out the UI for the app. Also, even though this app is pretty simple, it involves a lot of different widgets, each of which need an ID (and a string resource associated with it) so that we can refer to them in our code.
It’s much better to sit down and plan things out on paper first so that we can think through how the interface should look and how the components will interact with each other in terms of their logic. Stop! It’s always tempting to jump in and start building an interface or writing code, but professionals know that this always leads to extra work in the end.
#Tip calculator mobile app android
Click Finish and Android Studio will build the new project. Don’t forget to uncheck Backwards Compatibility (AppCompat). On the Customize the Activity screen, for Activity Name: use “TipCalculatorActivity”.Leave the defaults for everything else and keep clicking Next until you get to the Add an Activity to Mobile Choose Empty Activity ( not Basic Activity) and click Next. For the Application name: use “Tip Calculator”.I’ll leave it as an exercise for you to make it look better! Creating a New Project Yes, it’s a pretty plain looking app, but it demonstrates a lot of important ideas in Android development.
At this point you should be getting comfortable with navigating Android Studio and using the basic tools it provides to build a user interface for an app.įor our next app, let’s make an interactive “Tip Calculator” that will look like this –>