locationmanager,getLatitude function

by CSUIDL PROGRAMMEr » Thu, 23 Oct 2008 19:31:57 GMT


Sponsored Links
 Hello,
I am a newbie android developer. I am trying to simulate gps
functionality in android sdk 1.0.

I am using location manager  to get getlatitude function.

 http://pastebin.com/m56feb30c 

I am loading a google kml  through my ddms.

I get a java null pointer exception.
What am i doing wrong here

Thanks

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



locationmanager,getLatitude function

by Mast3rpyr0 » Thu, 23 Oct 2008 21:19:09 GMT


 does getLastKnownLocation have a location to give yet? try running
maps first then run your app



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


Sponsored Links


locationmanager,getLatitude function

by nkijak » Thu, 23 Oct 2008 21:24:48 GMT


 Hello,

I updated your code on that site to be more "correct". You should
stick with the static variable instead of hardcoding the string "gps".

You get a null pointer because you have to provide a location first,
meaning run the KML, then you can call getLastKnownLocation. When the
emulator starts, without being given a coordinate, it has no last
location. So try running the KML then running your app.

If you are trying to get continuous updates of location you should
implement LocationListener instead.

Nick



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



locationmanager,getLatitude function

by CSUIDL PROGRAMMEr » Mon, 03 Nov 2008 12:26:17 GMT


 Hello nkijak,
I could not find your upated code.
Also, i tried running the maps, ( including kml file, manually sending
decimal) .But the Nullpointer exception exists.
Is there anyone here who as got gps simulation working in android
here.
Thanks




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



Other Threads

1. when drag view, the view blink

Hello, everyone.
 I have a problem about the view drag. when i drag the view, it will
blink. The code like below:
<HorizontalScrollView android:id="@+id/HorizontalScrollView01"
                        android:layout_below="@id/bomb_l"
android:layout_width="wrap_content"
                        android:layout_height="wrap_content" 
android:scrollbars="none"
                        android:layout_marginBottom="20dip"
android:layout_marginTop="10dip">
                        <TableLayout android:id="@+id/TableLayout01"
                                android:layout_width="wrap_content"
android:layout_height="wrap_content">
                                <TableRow android:id="@+id/TableRow01"
                                        android:layout_width="wrap_content"
android:layout_height="wrap_content">
                                        <AbsoluteLayout 
android:id="@+id/answerSheet"
                                                
android:layout_width="wrap_content"
android:layout_height="wrap_content">
                                                 <TextView 
android:text="@+id/TextView01" android:id="@+id/
TextView01"

                                                        
android:layout_width="wrap_content"
android:layout_height="wrap_content"> </TextView>
                                        </AbsoluteLayout>
                                </TableRow>
                        </TableLayout>
                </HorizontalScrollView>

when i want to drag  TextView01, the view will blink
@SuppressWarnings("deprecation")
        @Override
        public boolean onTouchEvent(MotionEvent event) {

                if (isShowPress) {
                        int action = event.getAction();
                        switch (action & MotionEvent.ACTION_MASK) {
                        case MotionEvent.ACTION_DOWN:

                                return super.onTouchEvent(event);
                        case MotionEvent.ACTION_MOVE:
                                curX = event.getX();
                                curY = event.getY();


                                AbsoluteLayout.LayoutParams params = new
AbsoluteLayout.LayoutParams(
                                                135, 200, (int) curX, (int) 
curY);
                                this.setLayoutParams(params);

                                break;
                        case MotionEvent.ACTION_UP:
                        case MotionEvent.ACTION_CANCEL:
                                AbsoluteLayout.LayoutParams p = new 
AbsoluteLayout.LayoutParams(
                                                135, 200, 135, 0);
                                this.setLayoutParams(p);

                                break;
                        default:
                                break;
                        }
                }


                return true;
        }


how can solve this problem.
Thanks.

-- 

2. ORMLite now supports Android with native database calls

Howdy:

We've just released the 3.2 version of ORMLite ( http://ormlite.sourceforge.net/
) which has support for Android/Sqlite using the native Android OS
database calls -- i.e. not the crippled JDBC.  Android downloads here:

http://repo1.maven.org/maven2/com/j256/ormlite/ormlite-android/

A couple little sample projects can be downloaded here:

http://ormlite.sourceforge.net/android/examples/

Current [rather lame] Android documentation here.

http://ormlite.sourceforge.net/javadoc/ormlite-core/doc-files/ormlite_5.html#SEC20

Love to get some feedback on all of it.

thanks,
gray

-------------------------------

 ORMLite provides the following features:

 * Setup your classes by simply adding Java annotations.
 * Powerful abstract Database Access Object (DAO) classes.
 * Flexible QueryBuilder to easily construct simple and complex
queries.
 * Also supports a number of JDBC databases and can be extended to
others easily.
 * Handles "compiled" SQL statements for repetitive query tasks.
 * Supports "foreign" objects with the class field being the object
but an id stored in the database table.
 * Basic support for database transactions.
 * Auto generates SQL to create and drop database tables.
 * Support for configuring of tables and fields without annotations.

-- 

3. Could My Nexus One have been Hijacked?

4. apk size versus so file

5. The contacts scrollbar on Samsung glaxy i9000

6. Locate Android

7. Can I Create a VIEW which can access many tables in CONTACTS 2?