[android-developers] Re: Null Pointer exception in Location Manager

2010-09-29 Thread Gold
Hi,,


 Finally i got the solution..!

The mistakes are 1) I am not assign port to telnet
  2) Add uses permission for
mock location..now i got latitude..



Thanks  Warm Regards,
Gold

On Sep 29, 2:11 am, TreKing treking...@gmail.com wrote:
 On Tue, Sep 28, 2010 at 4:09 PM, Gold thangadura...@gmail.com wrote:
  hi..

  No ,  still i am checking, Now while loading home
  screen itself thorw the error
  The application stopped unexpectly in log also i get same error null
  pointer exception

  thanks  warm regards,
  gold

 A) Please respond to the group
 B) Again, use your debugger to step through your code around where it's
 throwing the exception. This should tell you EXACTLY what's null. The rest
 of us are not going to be able to debug your program for you like this.

 -
 TreKing http://sites.google.com/site/rezmobileapps/treking - Chicago
 transit tracking app for Android-powered devices

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: Null Pointer exception in Location Manager

2010-09-28 Thread Gold
Hi..Sorry,


   Herewith I attached Logcat trace..!


09-29 02:09:42.266: DEBUG/AndroidRuntime(2979): 
AndroidRuntime START 
09-29 02:09:42.276: DEBUG/AndroidRuntime(2979): CheckJNI is ON
09-29 02:09:42.536: DEBUG/AndroidRuntime(2979): --- registering native
functions ---
09-29 02:09:43.456: DEBUG/AndroidRuntime(2979): Shutting down VM
09-29 02:09:43.456: DEBUG/dalvikvm(2979): Debugger has detached;
object registry had 1 entries
09-29 02:09:43.486: INFO/AndroidRuntime(2979): NOTE: attach of thread
'Binder Thread #3' failed
09-29 02:09:44.056: DEBUG/AndroidRuntime(2987): 
AndroidRuntime START 
09-29 02:09:44.056: DEBUG/AndroidRuntime(2987): CheckJNI is ON
09-29 02:09:44.286: DEBUG/AndroidRuntime(2987): --- registering native
functions ---
09-29 02:09:45.306: INFO/ActivityManager(59): Starting activity:
Intent { act=android.intent.action.MAIN
cat=[android.intent.category.LAUNCHER] flg=0x1000
cmp=com.sample.test/.Starter }
09-29 02:09:45.476: DEBUG/AndroidRuntime(2987): Shutting down VM
09-29 02:09:45.526: DEBUG/dalvikvm(2987): Debugger has detached;
object registry had 1 entries
09-29 02:09:45.606: INFO/AndroidRuntime(2987): NOTE: attach of thread
'Binder Thread #3' failed
09-29 02:09:45.616: INFO/ActivityManager(59): Start proc
com.sample.test for activity com.sample.test/.Starter: pid=2995
uid=10040 gids={3003}
09-29 02:09:46.466: INFO/ActivityManager(59): Starting activity:
Intent { cmp=com.sample.test/.Home }
09-29 02:09:46.596: WARN/GpsLocationProvider(59): Duplicate add
listener for uid 10040
09-29 02:09:46.606: DEBUG/AndroidRuntime(2995): Shutting down VM
09-29 02:09:46.606: WARN/dalvikvm(2995): threadid=1: thread exiting
with uncaught exception (group=0x4001d800)
09-29 02:09:46.636: ERROR/AndroidRuntime(2995): FATAL EXCEPTION: main
09-29 02:09:46.636: ERROR/AndroidRuntime(2995):
java.lang.RuntimeException: Unable to start activity
ComponentInfo{com.sample.test/com.sample.test.Home}:
java.lang.NullPointerException
09-29 02:09:46.636: ERROR/AndroidRuntime(2995): at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:
2663)
09-29 02:09:46.636: ERROR/AndroidRuntime(2995): at
android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:
2679)
09-29 02:09:46.636: ERROR/AndroidRuntime(2995): at
android.app.ActivityThread.access$2300(ActivityThread.java:125)
09-29 02:09:46.636: ERROR/AndroidRuntime(2995): at
android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
09-29 02:09:46.636: ERROR/AndroidRuntime(2995): at
android.os.Handler.dispatchMessage(Handler.java:99)
09-29 02:09:46.636: ERROR/AndroidRuntime(2995): at
android.os.Looper.loop(Looper.java:123)
09-29 02:09:46.636: ERROR/AndroidRuntime(2995): at
android.app.ActivityThread.main(ActivityThread.java:4627)
09-29 02:09:46.636: ERROR/AndroidRuntime(2995): at
java.lang.reflect.Method.invokeNative(Native Method)
09-29 02:09:46.636: ERROR/AndroidRuntime(2995): at
java.lang.reflect.Method.invoke(Method.java:521)
09-29 02:09:46.636: ERROR/AndroidRuntime(2995): at
com.android.internal.os.ZygoteInit
$MethodAndArgsCaller.run(ZygoteInit.java:868)
09-29 02:09:46.636: ERROR/AndroidRuntime(2995): at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
09-29 02:09:46.636: ERROR/AndroidRuntime(2995): at
dalvik.system.NativeStart.main(Native Method)
09-29 02:09:46.636: ERROR/AndroidRuntime(2995): Caused by:
java.lang.NullPointerException
09-29 02:09:46.636: ERROR/AndroidRuntime(2995): at
com.sample.test.Home.onCreate(Home.java:38)
09-29 02:09:46.636: ERROR/AndroidRuntime(2995): at
android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:
1047)
09-29 02:09:46.636: ERROR/AndroidRuntime(2995): at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:
2627)
09-29 02:09:46.636: ERROR/AndroidRuntime(2995): ... 11 more
09-29 02:09:46.646: WARN/ActivityManager(59):   Force finishing
activity com.sample.test/.Home
09-29 02:09:47.156: WARN/ActivityManager(59): Activity pause timeout
for HistoryRecord{44095e38 com.sample.test/.Home}
09-29 02:09:57.664: WARN/ActivityManager(59): Activity destroy timeout
for HistoryRecord{44089b28 com.sample.test/.Starter}
09-29 02:09:57.675: WARN/ActivityManager(59): Activity destroy timeout
for HistoryRecord{44095e38 com.sample.test/.Home}
09-29 02:10:01.025: INFO/Process(2995): Sending signal. PID: 2995 SIG:
9
09-29 02:10:01.045: INFO/ActivityManager(59): Process com.sample.test
(pid 2995) has died.
09-29 02:10:01.045: WARN/GpsLocationProvider(59): Unneeded remove
listener for uid 1000
09-29 02:10:01.105: WARN/InputManagerService(59): Window already
focused, ignoring focus gain of:
com.android.internal.view.iinputmethodclient$stub$pr...@43f49530


On Sep 29, 1:36 am, TreKing treking...@gmail.com wrote:
 On Tue, Sep 28, 2010 at 3:33 PM, Gold thangadura...@gmail.com wrote:
  I tried but it will show Null pointer exception.

 Where? What's the stack trace?

 

Re: [android-developers] Re: Null Pointer exception in Location Manager

2010-09-28 Thread TreKing
On Tue, Sep 28, 2010 at 3:41 PM, Gold thangadura...@gmail.com wrote:

 09-29 02:09:46.636: ERROR/AndroidRuntime(2995): Caused by:
 java.lang.NullPointerException
 09-29 02:09:46.636: ERROR/AndroidRuntime(2995): at
 com.sample.test.Home.onCreate(Home.java:38)


Now which part of your code is at line 38?

-
TreKing http://sites.google.com/site/rezmobileapps/treking - Chicago
transit tracking app for Android-powered devices

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] Re: Null Pointer exception in Location Manager

2010-09-28 Thread Gold
Hi..

   While clicking the button1 that is
  redbtn.setOnClickListener(new
OnClickListener()
{

@Override
public void onClick(View v)
{

Toast.makeText(getBaseContext(),
Latitude : +
latitude.toString(), Toast.LENGTH_SHORT).
show();
}
});

Here it will show the exception


On Sep 29, 1:45 am, TreKing treking...@gmail.com wrote:
 On Tue, Sep 28, 2010 at 3:41 PM, Gold thangadura...@gmail.com wrote:
  09-29 02:09:46.636: ERROR/AndroidRuntime(2995): Caused by:
  java.lang.NullPointerException
  09-29 02:09:46.636: ERROR/AndroidRuntime(2995):     at
  com.sample.test.Home.onCreate(Home.java:38)

 Now which part of your code is at line 38?

 -
 TreKing http://sites.google.com/site/rezmobileapps/treking - Chicago
 transit tracking app for Android-powered devices

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


Re: [android-developers] Re: Null Pointer exception in Location Manager

2010-09-28 Thread TreKing
On Tue, Sep 28, 2010 at 3:49 PM, Gold thangadura...@gmail.com wrote:

 While clicking the button1 that is


Step through the debugger through this point and inspect the values of your
variables in the click listener. This will tell you exactly what's null in
there.

-
TreKing http://sites.google.com/site/rezmobileapps/treking - Chicago
transit tracking app for Android-powered devices

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] Re: Null Pointer exception in Location Manager

2010-09-28 Thread Gold

Hi,,

 If i click redbutton I need to display latitude
 if i click greenbutton i need to display longitude

How can i did that..! please give any solution..!


On Sep 29, 1:44 am, Kostya Vasilyev kmans...@gmail.com wrote:
 Your code doesn't seem to assign any values to redbtn and greenbtn.

 Then you call methods on these objects - perhaps they are still Null at that
 point?

 --
 Kostya Vasilyev --http://kmansoft.wordpress.com

 29.09.2010 0:34 пользователь Gold thangadura...@gmail.com написал:

 Hi..All,

                    I need to disply  current Position latitude and
 logintude .. I tried but it will show Null pointer exception.. here
 with i attached my code... please help me to solve this problem..
 I run this application on android emulator

 import android.app.Activity;
 import android.app.Dialog;
 import android.content.Context;
 import android.location.Location;
 import android.location.LocationListener;
 import android.location.LocationManager;
 import android.location.LocationProvider;
 import android.os.Bundle;
 import android.view.View;
 import android.view.View.OnClickListener;
 import android.widget.Button;
 import android.widget.Toast;

 public class Home extends Activity
 {
        private Button btn1;
        private Button btn2;
        private Button btn3;
        private LocationListener myLocationListener;
        private LocationManager myLocationManager;
        public String latitude;
        public String longitude;

        /** Called when the activity is first created. */
   �...@override
    public void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.home);

        myLocationManager =
 (LocationManager)getSystemService(Context.LOCATION_SERVICE);
        myLocationListener = new MyLocationListener();

 myLocationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER,
 1, 1, myLocationListener);

 latitude=String.valueOf(myLocationManager.getLastKnownLocation(LocationManager.GPS_PROVIDER).getLatitude());
                longitude =
 String.valueOf(myLocationManager.getLastKnownLocation(LocationManager.GPS_PROVIDER).getLongitude());

                btn1= (Button)findViewById(R.id.btn1);
                btn2= (Button)findViewById(R.id.btn2);
                btn3= (Button)findViewById(R.id.btn3);

                redbtn.setOnClickListener(new OnClickListener()
                {

                       �...@override
                        public void onClick(View v)
                        {

                                Toast.makeText(getBaseContext(), Latitude :
 +
 latitude.toString(), Toast.LENGTH_SHORT).show();
                        }
                });

                greenBtn.setOnClickListener(new OnClickListener()
                {

                       �...@override
                        public void onClick(View v) {
                                // TODO Auto-generated method stub
                                Toast.makeText(getBaseContext(), Longitude:
 +
 longitude.toString(), Toast.LENGTH_SHORT).show();
                        }
                });

                cancelBtn.setOnClickListener(new OnClickListener() {

                       �...@override
                        public void onClick(View v)
                        {
                                // TODO Auto-generated method stub
                                Toast.makeText(Home.this, NO gps,
 Toast.LENGTH_SHORT).show();

                        }
                });

        }

         public class MyLocationListener implements LocationListener
         {
                        public void onLocationChanged(Location argLocation)
                        {
                                if(argLocation != null)
                                {
                                        latitude =
 String.valueOf(argLocation.getLatitude());
                            longitude =
 String.valueOf(argLocation.getLongitude());
                        }
                        }
                    public void onProviderDisabled(String provider)
                    {
                    }
                public void onProviderEnabled(String provider)
                {
                }

                    public void onStatusChanged(String provider, int status,
 Bundle
 arg2)
                    {
                    }

        };

 }

 Thanks  Warm Regards,
 gold

 --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com
 For more options, visit this group 
 athttp://groups.google.com/group/android-developers?hl=en

-- 
You received this message because you are subscribed to the Google
Groups Android Developers 

Re: [android-developers] Re: Null Pointer exception in Location Manager

2010-09-28 Thread TreKing
On Tue, Sep 28, 2010 at 4:00 PM, Gold thangadura...@gmail.com wrote:

  If i click redbutton I need to display latitude
 if i click greenbutton i need to display longitude


OK. Does this mean you fixed your null pointer problem?


  How can i did that..! please give any solution..!


Do what? Solution to what? Clicking buttons? Getting lat / long? Displaying
to where? On a map? On the screen? On a button? In the logs?

-
TreKing http://sites.google.com/site/rezmobileapps/treking - Chicago
transit tracking app for Android-powered devices

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] Re: Null Pointer exception in Location Manager

2010-09-28 Thread TreKing
On Tue, Sep 28, 2010 at 4:09 PM, Gold thangadura...@gmail.com wrote:

 hi..

 No ,  still i am checking, Now while loading home
 screen itself thorw the error
 The application stopped unexpectly in log also i get same error null
 pointer exception


 thanks  warm regards,
 gold



A) Please respond to the group
B) Again, use your debugger to step through your code around where it's
throwing the exception. This should tell you EXACTLY what's null. The rest
of us are not going to be able to debug your program for you like this.

-
TreKing http://sites.google.com/site/rezmobileapps/treking - Chicago
transit tracking app for Android-powered devices

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en