andbook!.pdf - Learning Android Get an anddev.org - Android-Shirt Back to index
anddev.org Header Logo
FAQ Search Top rated articles Browse Feeds anddev.org - Authors Contact Details Register Log in

The Friend Finder - MapActivity using GPS - FULL SOURCE

Goto page Previous  1, 2, 3, 4, 5  Next
 
       anddev.org - Android Development Community | Android Tutorials | Index -> Map Tutorials
Author Message
rmeph
Senior Developer


Joined: 10 Dec 2007
Posts: 109
Location: India

PostPosted: Fri Dec 21, 2007 1:22 pm    Post subject: Reply with quote

i debugger code but not problem in code
when i started application ......in starting show error.
Code:
"org.anddev.android.friendfinder unable to start activity ComponentInfo {org.anddev.android.friendfinder/org.anddev.android.friendfinder.FriendFinder}:java.lang.IndexOutofBoundsException"
Back to top
View user's profile Send private message
plusminus
Site Admin


Joined: 14 Nov 2007
Posts: 2102
Location: Germany

PostPosted: Fri Dec 21, 2007 5:07 pm    Post subject: Reply with quote

Hello rmeph,

without the line the error occurs, we cannot help much Smile
Does it happen on startup or when you click sth. Question

Did you create some Contacts before Question

Regards,
plusminus

_________________

| Android Development Community / Tutorials
Back to top
View user's profile Send private message Send e-mail Visit poster's website
navajo
Freshman


Joined: 21 Dec 2007
Posts: 4
Location: Germany

PostPosted: Fri Dec 21, 2007 6:38 pm    Post subject: LocationSpot on Map is not updated (repainted)! Reply with quote

Hi plusminus,

as i run ur code for first few times, the appl. worked properly, but now the spot position is not repainted anymore. Coordinates and distance are updated, but not the spot position on map.
This happened first time as i tried to center the map according to the actual position. I changed the code and than, after compile and relaunch repainting stopped. So i reversed all changes but still there is no repainting!
I even set a complete new project in eclipse and reused ur code there-->same problem. I moved the appl. out of emulator, tried all what came to my mind with adb_server commands, deleted tmp data of emulator... nothing helped. The rest is well-oiled except repainting the map...
I m using WinXP SP2 with Eclipse IDE and latest JDK.
Any idea what i can do more to solve this?
And one more question: is there a efficient way to center map to a actual locationSpot, so the map moves and not my location?

Many thanks to a helpful code!

_________________
In a world without walls and fances... who needs Windows and Gates?
Back to top
View user's profile Send private message
plusminus
Site Admin


Joined: 14 Nov 2007
Posts: 2102
Location: Germany

PostPosted: Fri Dec 21, 2007 9:26 pm    Post subject: Reply with quote

Hello navajo,

hard to say what is wrong with your code...

Java:
this.myMapView = new MapView(this);
this.myMapView.getController().centerMapTo(point, updateSelection);


Regards,
plusminus

_________________

| Android Development Community / Tutorials
Back to top
View user's profile Send private message Send e-mail Visit poster's website
rmeph
Senior Developer


Joined: 10 Dec 2007
Posts: 109
Location: India

PostPosted: Sat Dec 22, 2007 7:53 am    Post subject: Reply with quote

yes it's was happend on startup.........yes i created contacts before start application...........i debugger code but not problem in any line.....how to solved it? Crying or Very sad
Back to top
View user's profile Send private message
plusminus
Site Admin


Joined: 14 Nov 2007
Posts: 2102
Location: Germany

PostPosted: Sat Dec 22, 2007 5:18 pm    Post subject: Reply with quote

Hello rmeph,

the error should also occur, when you do "live"-debugging...
Set a breakpoint to the first line of every function and go through step by step.
Without the line we cannot really help Sad

Regards,
plusminus

_________________

| Android Development Community / Tutorials
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Constantine
Freshman


Joined: 14 Jan 2008
Posts: 2

PostPosted: Mon Jan 14, 2008 1:53 am    Post subject: ZIP Reply with quote

Thank you for the work!
Can I please download this sample in a single zip file?
Back to top
View user's profile Send private message
plusminus
Site Admin


Joined: 14 Nov 2007
Posts: 2102
Location: Germany

PostPosted: Mon Jan 14, 2008 8:27 am    Post subject: Reply with quote

Hello Constantine,

I just added it to the end of the first post as an attachment.

Regards,
plusminus

_________________

| Android Development Community / Tutorials
Back to top
View user's profile Send private message Send e-mail Visit poster's website
shakespit
Once Poster


Joined: 25 Jan 2008
Posts: 1

PostPosted: Fri Jan 25, 2008 6:04 pm    Post subject: a better regexp for a geotag Reply with quote

Hi plusminus!

I wrote a more powerful regular expression for geotags and moved it's compilation out from a do-while loop.

I expect geotag in following format:
Code:
geo: +/-lat (-90 to 90), +/-lng (-180 to 180) [, +/-alt]

(based on http://tools.ietf.org/html/draft-mayrhofer-geo-uri-00 ) and regexp catches lat, lng and alt in groups 1, 5 and 13 respectively.

So no more # in geotag is required but it's ok if it'l stay there

I think that static function with a regexp parser will be more convinient, but anyway, here is my version of a refreshFriendsList ():
Java:

     private void refreshFriendsList(){
          Cursor c = getContentResolver().query(People.CONTENT_URI,
                    null, null, null, People.NAME + " ASC");
          /* This method allows the activity to take
         * care of managing the given Cursor's lifecycle
         * for you based on the activity's lifecycle. */

          startManagingCursor(c);

          int notesColumn = c.getColumnIndex(People.NOTES);
          int nameColumn = c.getColumnIndex(People.NAME);

          // Moves the cursor to the first row
          // and returns true if there is sth. to get
          if (c.first()) {
               // Pattern for extracting geo-ContentURIs from the notes.
               final String geoPattern = "\\bgeo:\\s*([-+]?(90(\\.0*)?|[0-8]?[0-9](\\.[0-9]*)?))\\s*," + "\\s*([-+]?(1(80(\\.0*)?|[0-7]?[0-9](\\.[0-9]*)?)|([0-9]{1,2}(\\.[0-9]*)?)))(\\s*,\\s*([-+]?[0-9]*(\\.[0-9]*)?))?\\b";
               // Compile and use regular expression
               Pattern pattern = Pattern.compile(geoPattern);

               do {      
                    String notesString = c.getString(notesColumn);
                    
                    Location friendLocation = null;
                    if (notesString != null) {
                         CharSequence inputStr = notesString;
                         Matcher matcher = pattern.matcher(inputStr);

                         if (matcher.find()) {
                              Double latid = Double.parseDouble(matcher.group(1));
                              Double longit = Double.parseDouble(matcher.group(5));
                              
                              friendLocation = new Location();

                              friendLocation.setLatitude(latid.doubleValue());
                              friendLocation.setLongitude(longit.doubleValue());
                              
                         }
                    }
                    String friendName = c.getString(nameColumn);
                    allFriends.add(new Friend(friendLocation, friendName));
               } while (c.next());
          }
     }
Back to top
View user's profile Send private message
plusminus
Site Admin


Joined: 14 Nov 2007
Posts: 2102
Location: Germany

PostPosted: Fri Jan 25, 2008 6:48 pm    Post subject: Reply with quote

Hi shakespit,

oops Embarassed, of course pulling the pattern-compile out of the loop is very wise Exclamation

Thx for sharing your thoughts.

Regards,
plusminus

_________________

| Android Development Community / Tutorials
Back to top
View user's profile Send private message Send e-mail Visit poster's website
hama
Freshman


Joined: 28 Dec 2007
Posts: 2

PostPosted: Wed Jan 30, 2008 1:05 pm    Post subject: Application not Responding Reply with quote

Hi, all

I have often experienced the alert of "Application not Responding".
The following warnings also appear in logcat.

W/ActivityManager( 465): Timeout of broadcast BroadcastRecord{4021f050 android.intent.action.LOCATION_CHANGED}
W/ActivityManager( 465): Receiver during timeout: BroadcastFilter{4020b368 android.app.IIntentReceiver$Stub$Proxy@4020b0d0}

I noticed that onReceiveIntent() is called in a chunky manner when such warnings/alert appear.
Does anyone have an idea why it occurs or how to fix it?

Thanks,

hama
Back to top
View user's profile Send private message
plusminus
Site Admin


Joined: 14 Nov 2007
Posts: 2102
Location: Germany

PostPosted: Wed Jan 30, 2008 6:22 pm    Post subject: Re: Application not Responding Reply with quote

Hello hama,

the following message means that there was no IntentReceiver that wanted to receive our custom "android.intent.action.LOCATION_CHANGED"-Action.
Java:
W/ActivityManager(  465): Timeout of broadcast BroadcastRecord{4021f050 android.intent.action.LOCATION_CHANGED}

As FriendFinder-application is the only application aware of this intent, there is probably something wring with your code. With me it works all fine.

Regards,
plusminu

_________________

| Android Development Community / Tutorials
Back to top
View user's profile Send private message Send e-mail Visit poster's website
nisha
Experienced Developer


Joined: 15 Feb 2008
Posts: 79

PostPosted: Fri Feb 15, 2008 8:04 am    Post subject: Including Search and Direction options in FriendFinder Reply with quote

hi plusminus,

I am new to android.. i tried ur friendfinder and it is really good.. Can you tel me how to include search and direction options, so that i can get the complete path to reach my friend.. which is similar to cellidtolatlong tutorial..

It would be nice if you reply me as early as possible..

Thanks Laughing
Back to top
View user's profile Send private message
plusminus
Site Admin


Joined: 14 Nov 2007
Posts: 2102
Location: Germany

PostPosted: Fri Feb 15, 2008 11:11 am    Post subject: Reply with quote

Hello nisha,

there already is a Source Driving-Directions Tutorial.
Which way made for m3-xxx SDK but should work for m5 (new SDK) with very slight changes.

Regards,
plusminus

_________________

| Android Development Community / Tutorials
Back to top
View user's profile Send private message Send e-mail Visit poster's website
intellibitz
Once Poster


Joined: 20 Feb 2008
Posts: 1
Location: Chennai, TamilNadu, India.

PostPosted: Wed Feb 20, 2008 3:46 pm    Post subject: Re: Emulator error :) Reply with quote

The following permission needs to be added to AndroidManifest, if you are using the latest m5 release.

<uses-permission android:name="android.permission.ACCESS_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_GPS"/>

After running, I'm getting the same error as venkat. Probably the GPS not supports anything other than SF area. I remember reading something along those lines in the docs.

venkat wrote:
Dear +/-,
while i am running your code i am getting my Contacts displaying like below,

zzzzzzzz (not set km)
xyzzzzzw(not set km)
abcdeww(not set km)


it's not handling click event at all. it's displaying nothing. can you tell me what is may be the error ???

Thanks in advance,

regards,
venkat Question

_________________
http://intellibitz.com
We develop innovative solutions for mobile handsets, using Android.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
       anddev.org - Android Development Community | Android Tutorials | Index -> Map Tutorials All times are GMT + 1 Hour
Goto page Previous  1, 2, 3, 4, 5  Next
Page 3 of 5

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


© 2007, Android Development Community
All rights reserved.
Powered by phpBB.