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. GL11 Implementation Issues

Regarding the support or lack of support for OpenGL ES 1.1.
I know that officially the emulator and also the G1 device do not
support OpenGL 1.1.
And I suppose that officially, the SDK does support OpenGL 1.1 (the
interface exists).

Fact is that when GLSurfaceView creates an instance of a class that
implements the GL interface, that class also implements the GL11
interface (this happens on both emulator and device).
I suppose some of the functions in that class are implemented as empty
stubs, or only prints some 'unsupported' log message.

However, the fact is that the MSM7205 chip (ATI Imageon GPU) that is
inside the G1, does support 'most' of the major features of OpenGL 1.1
standard.
It supports GL_COMBINE modes, user defined clipping planes, etc... (I
think also buffer objects)

So when running on the G1 device I would expect that calling:
gl.glTexEnvx( GL11.GL_TEXTURE_ENV, GL11.GL_TEXTURE_ENV_MODE,
GL11.GL_COMBINE);
Will pass through the interface and the drivers and reach H/W GPU and
set the TEXTURE_ENV_MODE to COMBINE.
But according to tests I've made it seems someone is intercepting that
call on its way to the H/W GPU.

Can anyone please clarify this issue?
--~--~---------~--~----~------------~-------~--~----~

2. Problem to communicate with a service from an application

Hi, i have some problem to communicate with a service from an Android 
application.

The service is in a first package "package com.myService" and the application 
in another on "package com.myApplication".

My service work and start well but my next step is to add an AIDL interface to 
external applications.

I have tried to follow the recomandation described here : 
http://developer.android.com/guide/developing/tools/aidl.html, but i have still 
the following error (given in the log service):


W/ActivityManager(  568): Unable to start service Intent { 
action=com.MyApplication.IBootstrapService }: not found

My AIDL defined in both packages is : 


interface IMyservice
{
    String GetVal1();
    
    String GetVal2();
    
    // Get the status of the public API
    int getStatus();
}

About the AndroidManifest.xml files : 



<?xml version="1.0" encoding="utf-8"?>

    package="com.Myservice" 
    android:versionCode="1" 
    android:versionName="1.0">
    <application android:label="@string/app_name">
        <service android:name=".Myservice" />
        <receiver android:name=".OnBootReceiver">
            <intent-filter>
                <action android:name="android.intent.action.BOOT_COMPLETED" />
            </intent-filter>                      
        </receiver>    
        <receiver android:name=".OnWiFiEnableReceiver">
            <intent-filter>
                <action android:name="android.net.wifi.WIFI_STATE_CHANGED" />
            </intent-filter>
        </receiver>
    </application>
    <uses-sdk android:minSdkVersion="3"></uses-sdk>
    <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
    <uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" />
    <uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />    
</manifest>



<?xml version="1.0" encoding="utf-8"?>

      package="com.MyApplication"
      android:versionCode="1"
      android:versionName="1.0">
    <application android:icon="@drawable/orange" 
android:label="@string/app_name">
        <activity android:name=".MyApplication"
                  android:label="@string/app_name">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>
    <uses-sdk android:minSdkVersion="3" />
</manifest> 

Why in each example, there is an application AND a service in the same package 
? Is is mandatory to do this ?

Regards


Thierry GAYET
NextInnovation.org
+33(0)663.849.589



      
--~--~---------~--~----~------------~-------~--~----~

3. Adding Threshold to Bitmap Images

4. URL url

5. How do you populate a spinner from a cursor

6. Running listeners in separate threads (=> not in the main thread)

7. Writting and AIDL between a service and an applciation.