I want to test out crash report using acra but the first step is I need to simulate a fatal crash in Android using code. Any idea? Answer Just execute this code: divide by zero Update: Also can try this Create a method, And call this somewhere/buttonClick OR simply throw an uncaught exception Bingo!
Tag: android
How To: Voice Commands into an android application
There are many tutorials online for adding voice recognition to an android app. They are often confusing and the publishers of the coding are never available for questions. I need a basic overview of …
Is there a need to use super.onActivityResult() in onActivityResult()?
Which one is better and why? This one: or this: Answer The first one is better. It’s more consistent with other event functions in the Activity API, it costs you nothing (the code you’re calling does nothing at the moment), and it means you don’t need to remember to add the call in the future when the behaviour of the
How to recursively scan directories in Android
How can I recursively scan directories in Android and display file name(s)? I’m trying to scan, but it’s slow (force close or wait). I’m using the FileWalker class given in a separate answer to this question. Answer You should almost always access the file system only from a non-UI thread. Otherwise you risk blocking the UI thread for long periods
SharedPreferences being reset after force close
I have been able to successfully implement Shared Preferences into my application but I have ran into a problem with the data being reset/deleted if I kill the application through a task manager. I am using a static method for saving, that way I only need the method once and can call it everywhere within my app. As soon as
Can’t start Eclipse – Java was started but returned exit code=13
I am trying to get my first taste of Android development using Eclipse. I ran into this problem when trying to run Eclipse, having installed version 4.2 only minutes ago. After first trying to start Eclipse without any parameters to specify the Java VM, I got an error message saying it couldn’t find a Java VM called javaw.exe inside the
How to check if current thread is not main thread
I need to check if the thread running a certain piece of code is the main (UI) thread or not. How can I achieve this? Answer if this returns true, then you’re on the UI thread!
Android: javac vs Dalvik
My understanding is that Google didn’t like Oracle’s licensing policy for using the JRE in Java ME so it just rewrote it using its own JVM specification that mimics the JRE but behaves a little bit differently, especially when it comes to making things more efficient and more secure. So, if my understanding is correct, it means that when javac
Regarding the checked state of a Radio button
I currently have a layout where if the user presses the option 1 button a new layout is set where the radio button to its right is checked. Then the “Checker” button gets a new onClick value. How can I change this within the java code so that the option1clicked method sets the first radio buttons checked value to “true”.
What’s the best way to check if a String contains a URL in Java/Android?
What’s the best way to check if a String contains a URL in Java/Android? Would the best way be to check if the string contains |.com | .net | .org | .info | .everythingelse|? Or is there a better way to do it? The url is entered into a EditText in Android, it could be a pasted url or it