PLEASE READ ME BEFORE POSTINGTips


Last Updated:

  1. LV426

    LV426 Well-Known Member VIP Member This Topic's Starter

    Joined:
    Oct 16, 2015
    Messages:
    2,768
    Likes Received:
    3,517
    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.

    NOTES FOR BEGINNERS..

    Android programming requires you to be familiar with the Java programming language. If you are 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:

    http://developer.android.com/training/index.html

    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. Note that the Android runtime environment is based on Java 6. Here's a link:

    http://www.oracle.com/technetwork/java/javase/downloads/java-archive-downloads-javase6-419409.html

    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:

    http://developer.android.com/sdk/index.html

    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!

    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.

    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] tags. This will ensure that the code is nicely formatted, indented, and easy to read.
    Example:

    Code (Text):
    1.  
    2. public class MainActivityextendsActivity{
    3.  
    4.    @Override
    5.    publicvoid onCreate(Bundle savedInstanceState){
    6.       super.onCreate(savedInstanceState);
    7.       setContentView(R.layout.activity_main);
    8.    }
    9.  
    10.    @Override
    11.    publicboolean onCreateOptionsMenu(Menu menu){
    12.       getMenuInflater().inflate(R.menu.activity_main, menu);
    13.       returntrue;
    14.    }
    15. }
    16.  

    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

    StackOverflow

    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/

    Other resources

     

    Advertisement
    Last edited: Apr 11, 2016
    #1
  2. scary alien

    scary alien not really so scary Moderator

    Joined:
    Mar 5, 2010
    Messages:
    21,891
    Likes Received:
    22,580

Share This Page

Loading...