Any idea why the following code crashes the app? It happens in calculateGmt()

by Justin Anderson » Wed, 21 Apr 2010 15:53:15 GMT


Sponsored Links
 First thing I noticed right off the bat is that you aren't checking for the
case where the input can't be parsed to a double...  That throws an
exception and since you aren't handling that that would crash your app.

Second thing I noticed is that hideous @SuppressWarnings thing....  In my
opinion if you need to do that then you need to rethink what you are doing.

Last, but not least, check the logcat output when you get a crash... it will
tell you more about why it is crashing.

----------------------------------------------------------------------
There are only 10 types of people in the world...
Those who know binary and those who don't.
----------------------------------------------------------------------





>



Any idea why the following code crashes the app? It happens in calculateGmt()

by Indicator Veritatis » Thu, 22 Apr 2010 06:48:29 GMT


 I'm not seeing enough info for me to run this myself under Eclipse
DDMS and see the exception -- which is probably your best bet for
diagnosing the problem. Or, if it crashes before it waits for user
input, you should use Debug: 1) set a breakpoint by double-clicking on
the bar to the left of the line number in the Java source code editor
2) instead of doing Run As (or ctl-F11 or the corresponding tool),
launch the debugger by clicking on the tool that looks like a bug or
by doing F11 instead of ctl-F11. You can always switch back to DDMS
perspective in Eclipse after that and look in the Logcat output for
the exception.

Or, as either an alternative, or in addition to the above, you might
want to break up complicated lines like

"double val = Double.parseDouble(gmtinput.getText().toString());"

into multiple assignment statements. That will reveal where, for
example, you forgot to actually allocate memory for the result.



>


Sponsored Links


Any idea why the following code crashes the app? It happens in calculateGmt()

by Indicator Veritatis » Thu, 22 Apr 2010 06:57:11 GMT


 ll good points!

In particular, the OP should have told us what the warning suppressed
really was. It might have been the hint he needed to solve the
problem. Or it might have been just another attempt to suppress the
spurious warning messages from Eclipse -- which sometimes says you
need to Override a method you have already Overriden.

And just to connect a few dots: the easiest way to get to Logcat and
search the output is to switch to DDMS perspective, find the Logcat
tab, bring it to the front and maximize it. Then you can delete the
previous contents of the log and just watch the world scroll by. Or
play around with filters, though that is not necessary for this
problem.

It also helps to watch this Logcat output on a known good program run,
so that you can get used to which error message can be ignored.
Unfortunately, even for a program running perfectly OK on the
emulator, we see Java exceptions and other error messages in Logcat.

On Apr 21, 12:51am, Justin Anderson <janderson....@gmail.com> wrote:
> >



Other Threads

1. Smart Keyboard PRO v1.2.

Kalau nggak salah kemaren ada yang nanyain apps ini :)

Requirements: Android
Overview: Multitouch keyboard with english, french, spanish and russian
layouts. * Long press on ?123 key for sett

[image: Image]

v1.2.2 (08/02/2010)
- Fixed regressions introduced in 1.2.1

More Info:
**
http://android.cdeguet.net

Download Link:
http://depositfiles.com/files/r7pvgucy4

Maaf kalau repost :)


-- 
Deska Affif
P: 0818-177-172 | Y!: GadgetGaya
http://GadgetGaya.com  |  Gadget Accessories Online Store

-- 
"Indonesian Android Community [id-android]" 

2. Dialog problem

Hello,

I'm trying to make a dialog box to open when I start a program.
Eclipse likes my code, I like my code =), but the emulator does not
like my code. It says that something went totally worong and the
application has to shut  down. Bellow you can see my code. When I run
it in debug mode everything seems to go as it should but when it gets
to "return dialog; " eclipse debug windows says source not found.
Anyone have any suggestions?

regards
Andr

package com.test.popup;

import android.app.Activity;
import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import android.widget.TextView;

public class popup extends Activity {
        static final int DIALOG_NEW = 0;
        static final int DIALOG_NEW2 = 1;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        showDialog(DIALOG_NEW2);
    }
    protected Dialog onCreateDialog(int id) {
        Context mContext = getApplicationContext();
        Dialog dialog = new Dialog(mContext);
        switch(id) {
        case DIALOG_NEW:
                dialog.setContentView(R.layout.popup_new);
                dialog.setTitle("Custom Dialog");

                TextView text = (TextView) dialog.findViewById(R.id.text);
                text.setText("Hello, this is a custom dialog!");
            break;
        case DIALOG_NEW2:
                dialog.setContentView(R.layout.popup_new);
                dialog.setTitle("Custom Dialog");

                TextView text2 = (TextView) dialog.findViewById(R.id.text);
                text2.setText("Hello, this is a custom dialog!2");
            break;
        default:
            dialog = null;
        }
        return dialog;
    }
}

-- 

3. Battle 2 dragons, bagus mana?

4. how to deal complex sql in ContentProvider

5. How can I replace adbd on the device / emulator ?

6. java.lang.NoClassDefFoundError: android.view.ScaleGestureDetector

7. android on the arm?