0

in my project first i find the user location and then i want open new activity and show user location on the map but when program want to read the thired lind program go to the debug mode and show invocationtargetexception ...? why program show this ? in secend activity i use the fragmentactivity ..

double latitude = gps.getLatitude();
            double longitude = gps.getLongitude();
            Intent is = new Intent(getBaseContext(), Location_find.class);
                is.putExtra("latitude",String.valueOf( latitude));
                is.putExtra("longitude",String.valueOf( longitude));
                startActivity(is);
Cœur
  • 37,241
  • 25
  • 195
  • 267

2 Answers2

0

Don't use getBaseContext(). Instead use your Activity Context. Change it to

Intent is = new Intent(ActivityName.this, Location_find.class);

If this doesn't help then please post your logcat.

codeMagic
  • 44,549
  • 13
  • 77
  • 93
  • it doesnt work. i am new in android and i dont know how i can find logcat – user2428538 Sep 24 '13 at 23:07
  • Are you using Eclipse? – codeMagic Sep 24 '13 at 23:08
  • [See this link](http://stackoverflow.com/questions/3280051/how-to-enable-logcat-console-in-eclipse-for-android) then post your logcat – codeMagic Sep 24 '13 at 23:12
  • in logcat only show 09-25 02:45:25.515: I/System.out(5832): >>>>>>label name::Sayna 09-25 02:45:28.370: I/System.out(5832): >>>>>>label name::Sayna – user2428538 Sep 24 '13 at 23:16
  • and in debug window Thread [<1> main] (Suspended) ZygoteInit$MethodAndArgsCaller.run() line: 1041 ZygoteInit.main(String[]) line: 805 NativeStart.main(String[]) line: not available [native method] – user2428538 Sep 24 '13 at 23:17
  • Filter your logcat by "error". If it crashed then there will be more information. – codeMagic Sep 24 '13 at 23:20
  • i try to open new easy activity without any thing and it is work but when i chang it to extended fragmentactivity and again read same line to open new activity i see same exception... – user2428538 Sep 24 '13 at 23:44
  • this is error that i see in log cat 09-25 03:23:17.435: E/AndroidRuntime(29978): Caused by: java.lang.NoClassDefFoundError: com.home.sayna.Location_find – user2428538 Sep 24 '13 at 23:54
0

Make sure to list any activities you use in your app in the app's AndroidManifest.xml

Gil Moshayof
  • 16,633
  • 4
  • 47
  • 58