Getting started with app development for Java newbies

Yashovardhan Dhanania
8 min readJul 24, 2019

--

It is the beginning of the new college year, thousands of students are leaving their schools for the first time and entering College. Some of them are well-versed with Java. One of the first questions these people ask are I know Java upto XX, what should I do now? Should I learn a new programming language? Should I learn more Java? What do I do?

It’s a really good question when you think of it. I was asking the same questions 2 years back. This article intends to answer a part of that question.What you can do with your limited knowledge of Java. There will not be much of coding here (I may write another article for that a bit later:). It is intended to introduce you to the world of Android App Development and attempt to answer a part of your question. If you don’t have any experience with Java, you can still read this course to find out how much Java is needed in app development.

Question 1: I know Java upto XX, should I learn another language?

Ok, first of all, let’s ask ourselves, what is a programming language? A programming language is just a way of expressing something. What you have actually learned in school (or otherwise) are actually important concepts which can be used with almost any other modern programming language. Sure, each language has it’s pros and cons. You won’t be developing mobile apps in Python and you won’t be writing Machine Learning models in C. However, the basic principles remain the same. Concepts like OOPS, searching and sorting algorithms, functions are essentially the same across multiple languages, what changes is just the syntax.

So, should you actually learn another language? I won’t suggest running for it but you can give it a try. I would suggest learning Python if you wish to try out data science or some JavaScript (Along with HTML and CSS) if you want to build websites.
Side Note: What about C/C++? You will be learning C in your 1st year in most colleges (if you are a B.Tech student in India). C++ is also similar to C. So, I won’t suggest learning these languages now only to relearn them in college again.

Photo by Markus Spiske on Unsplash

Getting started with android development!

Are there any prerequisites?

Indeed there are! You need to have a fair understanding of the following concepts in Java to get started.

  1. Basics : Variables, types, Expressions, Math, Strings, Methods/functions,
  2. Control Flow : If-else, Switch case, loops
  3. Data Structures : Arrays, ArrayLists (a fair understanding of the classes available under the Collections framework is really helpful)
  4. Classes and Objects : Basic understanding of classes, objects.
  5. Inheritance : Extending classes, Interfaces, Basic polymorphism.

If you have sufficient knowledge in these topics, you can get started right away! But if you need a refresher or are lacking in a particular concept, you can check out this free course on Coursera.

Tools Needed

You are going to need Android Studio with the Android SDK and the Java JDK + JRE to get started. You can get all that bundled right here: https://developer.android.com/studio

Apart from that, make sure you have a nice fast computer with a good RAM and CPU (and preferably SSD). Android Studio can really give you nightmares on a slow PC. Just trust me on this.

Android Pie

Basics of Android Development

Finally, let’s speak a bit about how exactly android works and how is it different from traditional Java programming (and what’s similar!)

App Dev in General

So let’s talk about App development in general. These points may also apply to Web Development somewhat.

Firstly, app development differs from your normal Java programming you have been doing till now in a big way.

The programs you write generally consist of a couple of classes with a main method which is the entry point of your app. Your programs generally use a single thread (unless you are using multiple threads for some reason) and call functions one-by-one. You use System.out.println() to display the output to the user and BufferedReader/Scanner class to take inputs from the keyboard. The user can only provide input when you ask them to and they can only do so with their keyboard typing something and then pressing enter to confirm the same.

Mobile apps or Web apps, on the contrary, are Event-Driven. This means they depend on user events (such as touch, swipe, click etc.) to decide what to do next. They don’t necessarily have a single entry point and don’t necessarily run on a single thread. You must have seen this on apps yourself!

Another important point for app dev in general is, apps have a separate layout integrated tightly with some functionality. In android, these layouts are written in XML (Don’t worry, you don’t really need to learn much here). Remember, you can’t just print something on the console here. You need to update the UI to show something to the user.

Lastly, design principles are really important for apps. These ensure different apps look similar and work in a similar fashion not confusing the user. Material Design Guidelines are the most widely accepted design principles for app developers. They help maintain the consistent looks across all your apps yet allowing you to customize your app according to your wish.

Android Dev

Coming to android, there are a couple of things you need to understand.

  • Apps provide multiple entry points: This is straight from the Build your first app guide, apps don’t just have a single entry point. You must have seen this already many many times.
    If you are reading this on the Medium app and followed a link, the app opened up directly on this article instead of opening the home page. When you press that share button and share it on WhatsApp, WhatsApp just gave you another way to access the app. However, apps also do have a MainActivity. Like the Main method in Java, this is responsible for starting the app when the user launches the app from the launcher by tapping your app icon.
  • Apps adopt to different devices: You know how android runs on some X billion devices (Sorry, I lost count now). Have you ever wondered how one app works across soo many different devices? I mean it’s different screen sizes, screen densities, hardware features etc. Just so many different devices running android (and some are not even phones) yet there are apps which work just fine on almost all these devices. Don’t worry! You don’t need to write separate code for all these different device types (Well, mostly). Android adopts to different screen layouts and automatically scales and gives the user the correct layout. Similarly, if your app requires a specific hardware feature (like camera), apps can check if the device has a camera and respond accordingly.
Source: Google Blog
  • Compatibility, compatibility, compatibility: One thing you will need to make sure is that your apps are compatible with older versions of Android. You know how Android Q is all the new craze now but you can’t just support Android Q. You need your app to work on devices with older versions of android. Don’t worry, it’s really easy to do so. You might wonder why we just don’t support all devices way back to Android 1? Well, the major reason for that is again compatibility. As new versions of android are released, newer libraries are released for developers making things a bit easier. These libraries may not work all the way back. You need to find the right balance between maximizing your user base and having the latest tools to develop your apps. Don’t worry, it’s not that tough.

Now, let’s discuss some key words/files you will come across:

Gradle? Manifest? What’s all this?

Gradle is the build system for android. See, how I mentioned about libraries? Well, similar to how you imported classes in Java, you will be importing libraries in your apps. These libraries can be either part of the official Android Architecture or even be third party libraries. Gradle helps you build all these libraries with your Java and XML code. tl;dr - It’s just a fancy thing which ties up everything in your project together to just make it all work. It’s also the thing you will be blaming half the times your app doesn’t work.

Manifest, on the other hand, is one of the most important files in your app. Similar to how a passenger manifest lists details of all the passengers in a flight, the manifest.xml file will list all the Activities and their intentions in your app. It also lists all the other important stuff like your app icons, name, permissions your app requires, hardware features needed, different entry points among other things. See how important this little file is.

Android Studio resource management. Source

Activity? Intents?

An Activity is pretty much like the real world activity. It does a specific task and represents a single screen on the app (such as a login activity).
Side Note: With the onset of Single Activity concepts, you might see apps with only a single activity and multiple fragments. Fragments are also similar to activities except that they live within an Activity. You will learn more about this later.

Intents are again similar to the real world meaning. An intent can be used to launch other activities in your own app and even in other apps! You can even get back results from these Activities to use with your own app.
Eg. A Photo-editing app opening the camera app to let the user click a picture and then using the result (picture) in it’s own activity (editing).

Too much information in a day? I know how it feels. This is just a very very basic overview of android development. It assumes that you are familiar with Java or programming in general. If you want to follow a course on android development, I recommend the Android Developer Fundamentals course by Google. If you just want to get a hang of making a Hello World app first, you can follow the guide at https://developer.android.com/training/basics/firstapp

I left out Kotlin from this post on purpose. It is really easy for Java developers to switch to Kotlin (especially for Android developers) and is actually recommended in a way. I will be covering Kotlin for android development in another article later.

A little about me?

I am Yashovardhan Dhanania, a 3rd year Computer science student at Manipal University Jaipur. I am also the founder of AndroidDev Jaipur. If you are interested in Android development, you can join the Telegram group at https://t.me/AndroidDevJaipur

Hope you liked this article! Do leave any suggestions below!

📝 Read this story later in Journal.

👩‍💻 Wake up every Sunday morning to the week’s most noteworthy stories in Tech waiting in your inbox. Read the Noteworthy in Tech newsletter.

--

--