The best way to debug in Android is to use LogCat. I've yet to figure out an easy way to do this though -- using NetBeans -- but it can be done. LogCat should be installed with your Android SDK and AVD (android virtual device) kits, however the problem is that NetBeans doesn't display logcat in a "console"-like format. I was looking at this tonight and figured out how you can still get your LogCat printout -- it just prints straight to a text file and not in a nice built-in display window like Eclipse has.
USING LOGCAT IN NETBEANS1) First, you'll have to add the adb tools path the Windows global variable (if you're on a mac you'll have to google how to do this). See http://www.shahz.net/android/adb-installation-and- how-to-logcat.html 2) Then, whenever you run your app and it crashes (or anytime you want to debug), open the command prompt and enter:adb logcat -v time > logcat.txtThis will create a file in the current folder with the current LogCat logs. You'll have a lot of stuff in there so it's important that you've used LogCat properly in your code so that you know what to look for. Run "start logcat.txt" to take a look.3) To to use LogCat in your code you'll first need to import the Log library:import android.util.Log;Then, down where you would normally print something out, you'll replace "System.out.println("HERE");" with:Log.d("LOGCAT", "HERE");4) Now, run the logcat command again, then open the text file with the start command:adb logcat -v time > logcat.txtstart logcat.txt5) Now, use CTRL-F "LOGCAT" to look through all your LOGCAT debugging statements.Also - If your app is crashing try searching for "E/AndroidRuntime"... this will take you to the information on what caused the error.
I know it's a little complicated, but it works! And it'll let you debug crash errors too. The problem with using toasts for debugging is that the app may crash before you ever reach the toast. Which... ends up not really helping you at all. So if you can bear the pain of these steps for your debugging, it should help out a lot! And if you find a better way to use LogCat in NetBeans please let me know. It would be awesome if they let you view the LogCat logs directly in NetBeans. Man that would be sweet. Good luck!
Let me know if you find any mistakes with the info above.