• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps ******** PLEASE READ ME BEFORE POSTING ********

Not open for further replies.

Deleted User

Welcome to the Android Application Development forum. This forum is designed to facilitate (and hopefully provide answers to) questions regarding the design and development of Android applications and games.


Do I need to write an app?

This may seem like an odd thing to start with, but it's worth thinking about, if you require cross platform compatibility. If your system needs to work on both Android and iOS, then you need to think about how to do this. An Android app written in Java isn't directly portable to iOS. Cross platform frameworks do exist, but they're not perfect for all applications. You may like to consider implementing the system as a website. This means that cross platform compatibility is guaranteed, because users access your system using the device's local web browser.

If you decide that you really need an app, then read on..

Android programming requires you to be familiar with the Java programming language. If you're a beginner with Java then you would be advised to pick up a good book. There are many available. Alternatively there are many online resources to get you started with the language.

In terms of Android programming, again there are many good books, and you can also find some excellent online tutorials. Here's a good place to start:


To begin developing Android apps, you need the JDK (Java Development Kit). Your computer may already have this installed, but if not, it's free to download. Get the latest JDK from here -


You will also need Android Studio. This is a powerful IDE (Integrated Development Environment), which is essential for developing Android apps. Download it from here:


It actually has a lot of sample applications that are useful to examine and learn how to do things, starting with a basic 'hello world' app.

But really, the best and most effective way to learn is just to get in there and write some code. If you have any more specific questions, feel free to ask here and you can get some more advice.
Good luck!

Don't do cut/paste coding without engaging your brain

Taking code from online sources is fine, many programmers do this and it can save a lot of time. However if you're a beginner, you should not simply copy blocks of code without taking the time to understand how it works. Reason for this, and it may sound obvious, is that when things go wrong, you'll have a very difficult time working out how to fix the problems. So next time you paste a section of code into your program, ask yourself if you really understand what it's doing.

If you have a problem, there's a lot you can do to help yourself. Read on..

There is no better way to understand and learn, than to work through a problem. Fortunately a modern IDE like Android Studio or Eclipse provides some very powerful features to help you..

Debugging your app

Many people seem to use Log statements in their code to try and diagnose problems. This is far from ideal, and there is a much better way to do it, by running your app in debug mode. This will allow you to set breakpoints, examine variable values, and step through the code execution, line by line. You can follow the logic, and spot problems. Learning how to use the debug facilities of the IDE is probably *the* most useful thing you can teach yourself.

Debugging - What's a stack trace?

Every time your code calls a method, the stack is used. This is an area of memory which tracks what method calls have been made. Think of it like one of those pop-up plate stackers in a restaurant. Methods call other methods, which then call others, and so entries get added recursively to the stack. It gets bigger.

When an application crashes or stops unexpectedly, it's due to a run time error. The system reports it as an 'Exception'. If the exception happened in a method which was at a deep level in the stack, then the error report unwinds all the method calls, back to the place in your code which started the sequence of method calls leading to the exception.

The stack trace is essential in tracking down problems, because it pinpoints the exact place in your code which caused the error. This is the vital piece of information you need to understand why your application is crashing. A typical stack trace is described here


Here's a guide to debugging with Android Studio - http://developer.android.com/tools/debugging/debugging-studio.html

To summarise, the following are the key things which will help you diagnose and fix your problem:-

  • Read the stack trace: The Logcat window shows all diagnostic output from your application. If your app crashed unexpectedly, a stack trace will be in the Logcat, which pinpoints the exact line in your code which caused the app to crash.
    See this page for a good explanation of how to read a stack trace and use it to diagnose problems in your code. http://stackoverflow.com/questions/...w-can-i-use-it-to-debug-my-application-errors

  • Breakpoints: Running your app in debug mode (see above link) will allow you to stop execution of your code at specific lines. You can then examine variables, step through the code, and figure out what's going on.

How to ask a question in this forum

You are more likely to get some help if you ask focussed questions on specific issues. With very broad or open ended questions it can be difficult to answer. Please note that you are very unlikely to get a comprehensive (or any) answer to the question 'write my code for me' or 'do my homework assignment'. We wouldn't be doing you any favours by spoon feeding code to you, because you'd learn very little, to nothing.
Similar to other technical forums, members like to see some evidence that you've put at least some effort or thought into the problem.

If you have a coding issue that you would like advice on, please enclose your code in [code][/code] tags. This will ensure that the code is nicely formatted, indented, and easy to read. You would be surprised how many people asking a programming related question here do not include their code, or include only a small isolated fragment of code. This makes it virtually impossible to answer the question. Include all relevant code parts to allow someone to understand the problem. This includes layout XML code.

Here's an example of nice formatted code:

public class MainActivityextendsActivity{

   publicvoid onCreate(Bundle savedInstanceState){

   publicboolean onCreateOptionsMenu(Menu menu){
      getMenuInflater().inflate(R.menu.activity_main, menu);

Application crashes

If your application crashes unexpectedly, your code will have thrown an exception.

If you ask for advice on the forum about an application crash, be sure to include the stack trace from the Logcat output.

Null pointer exceptions

The null pointer exception (NPE) is by far the most common cause of application crashes. Looking at the stack trace and your code will quite often explain what's gone wrong, but if not, your next course of action could be to run the application in debug mode, and set a breakpoint at the relevant line, as described above.
See here for more information http://stackoverflow.com/questions/218384/what-is-a-null-pointer-exception-and-how-do-i-fix-it


If you are a programmer, then StackOverflow is the most useful resource on the web to look for answers. It's so good that a lot of professional software developers don't know how they managed to do their job before it existed! It has thousands of questions, and most of them have good answers that will probably help you out. If you have a problem, chances are someone else already had the same problem, and it's been answered on StackOverflow. Check it out http://stackoverflow.com/

Application Architecture

Before you get started on developing an app, it's worth considering architectural issues. By this, I mean how your code is structured, in terms of its components and packages. A lot of applications involve storing information in a database. If you're not careful, your code can end up in a completely unorganised mess. This problem may not be apparent in the early stages of your project, but as you add more code, you'll probably run into difficulties, and maintenance of your code becomes a problem.

If your app uses a SQLite database, then seriously look at using the Room database mapping framework. This facilitates the connection of data in the database, to objects within your code. The usual goal is to present database information on forms or screens within your app. To do this in a structured way, you need to separate out the various functions, which reduces code dependencies, and enables more flexibility to change things, without causing problems in other parts of the codebase. It also helps to make testing your code easier. The tutorial below explains a very good architectural approach for interacting with a local database, and presenting the information in a RecyclerView. I strongly recommend that you follow this architecture, if your app fits into this pattern


Other resources

Last edited by a moderator:
Upvote 0
Not open for further replies.


We've been tracking upcoming products and ranking the best tech since 2007. Thanks for trusting our opinion: we get rewarded through affiliate links that earn us a commission and we invite you to learn more about us.