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 - Part: II / II

Goto page Previous  1, 2, 3, 4  Next
 
       anddev.org - Android Development Community | Android Tutorials | Index -> Map Tutorials
Author Message
navajo
Freshman
Freshman


Joined: 21 Dec 2007
Posts: 4
Location: Germany

PostPosted: Tue Jan 08, 2008 9:15 pm    Post subject: Reply with quote

When starting your application the map is always centered to Tulsa (USA). Where are the coordinates of this location defined? I mean: in which file in the android system can I find these coordinates?
_________________
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
Site Admin


Joined: 14 Nov 2007
Posts: 2624
Location: College Park, MD

PostPosted: Tue Jan 08, 2008 9:50 pm    Post subject: Reply with quote

Hello navajo,

you are talking of the "Me"-Location Question

But you can create Source your own Mock Location Provider (as real GPS-devices are not supported in the emulator).

Regards,
plusminus

_________________
Download my apps Idea
Please remember, that this board is give & take Smile

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


Joined: 21 Dec 2007
Posts: 4
Location: Germany

PostPosted: Tue Jan 08, 2008 10:11 pm    Post subject: Reply with quote

Thanks for your quick reply!

No, I'm not talking about ME-Location. I am talking about the coordinates when the map is first centered, and on my map this is Tulsa (USA). U use zoom level 3 in your code, and if I zoom in, then I get to Tulsa and not next to "Bayshore Fwy". I'm wondering where these default coordinates come from.

Defining my own mock-gps-provider is known to me...
Hope my question is more precise now Smile

_________________
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
Site Admin


Joined: 14 Nov 2007
Posts: 2624
Location: College Park, MD

PostPosted: Tue Jan 08, 2008 11:47 pm    Post subject: Reply with quote

Hello navajo,

hehe, didn't even recognize this, but when you open the System-Map-Activity the map is centered there to. (Thought that it the initial sdk-release it was pointing to the middle of the world map (atlantic ocean).

So perhaps on of the Android-Map-Activity-Coders lost a bet or sth. Laughing .

Regards,
plusminus

_________________
Download my apps Idea
Please remember, that this board is give & take Smile

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


Joined: 03 Jan 2008
Posts: 4

PostPosted: Wed Jan 09, 2008 10:24 am    Post subject: Reply with quote

Thanks - the below worked!

sth. like this should work:
Java:
      // Animate to the center
          myMapView.getController().animateTo(new Point(lat.intValue(),lng.intValue()));


Another question - is it possible to preload/cache the maps ?
(assuming you have/can simulate the gps track ?)
I.e if you expect no network coverage but you still like a moving map.
Back to top
View user's profile Send private message
plusminus
Site Admin
Site Admin


Joined: 14 Nov 2007
Posts: 2624
Location: College Park, MD

PostPosted: Wed Jan 09, 2008 5:34 pm    Post subject: Reply with quote

Hello glider,

haven't seen such a functionality yet, would probably be done centrally by the underlying System-Map-"""Provider""".
Caching data for specified customizable locations would be an idea, as it would just take a few megabytes for a medium town (but just on one Zoom-Level !)

Regards,
plusminus

_________________
Download my apps Idea
Please remember, that this board is give & take Smile

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


Joined: 07 Jan 2008
Posts: 2
Location: Netherlands

PostPosted: Thu Jan 10, 2008 10:02 am    Post subject: Reply with quote

Hello,

(my first post)
I used the next code to always center the "ME" location on the screen (in UpdateView):

Java:
         Point point = new Point(lat.intValue(), lng.intValue());
          myMapController.centerMapTo(point, false);
          this.myMapView.invalidate();


regards, KC
Back to top
View user's profile Send private message
glider
Freshman
Freshman


Joined: 03 Jan 2008
Posts: 4

PostPosted: Thu Jan 10, 2008 12:22 pm    Post subject: Reply with quote

Maybe if android use a http proxy ? Would that work in this case ?

Thanks for all your help!!!

plusminus wrote:
Hello glider,

haven't seen such a functionality yet, would probably be done centrally by the underlying System-Map-"""Provider""".
Caching data for specified customizable locations would be an idea, as it would just take a few megabytes for a medium town (but just on one Zoom-Level !)

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


Joined: 14 Nov 2007
Posts: 2624
Location: College Park, MD

PostPosted: Thu Jan 10, 2008 12:39 pm    Post subject: Reply with quote

glider wrote:
Maybe if android use a http proxy ? Would that work in this case ?


You would also have to connect to that Proxy and download cached data from it so, there will be no real advantage from such a possibility.

Regards,
plusminus

_________________
Download my apps Idea
Please remember, that this board is give & take Smile

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


Joined: 03 Jan 2008
Posts: 4

PostPosted: Thu Jan 10, 2008 12:54 pm    Post subject: Reply with quote

Well, you could always run a proxy ON the handheld itself to cache the data ?
(are there any lightweight java proxies around ?)

plusminus wrote:
glider wrote:
Maybe if android use a http proxy ? Would that work in this case ?


You would also have to connect to that Proxy and download cached data from it so, there will be no real advantage from such a possibility.

Regards,
plusminus
Back to top
View user's profile Send private message
crayder
Freshman
Freshman


Joined: 04 Feb 2008
Posts: 9

PostPosted: Mon Feb 04, 2008 1:02 am    Post subject: activity vs subactivity Reply with quote

Hi! I have a question according the activity running. If I am not mistaking all the activities can be run as subactivities and simply activities. I can't understand in what cases we need to use these two different methods... Could you please point me some materials where this topic is described?
Back to top
View user's profile Send private message
plusminus
Site Admin
Site Admin


Joined: 14 Nov 2007
Posts: 2624
Location: College Park, MD

PostPosted: Mon Feb 04, 2008 1:54 am    Post subject: Reply with quote

Hello crayder,

you can put a RequestCode to a startSubActivity(...); which you cannot put to startActivity(...);. SubActivities are very useful if you want to return values from them (i.e. an InputBox). To do that you'll overwrite onActivityResult(...) where is a parameter "requestCode" which is used to determine which SubActivity actually is returning.(The requestCode is the same as you called startSubActivity(...); with).

Regards,
plusminus

_________________
Download my apps Idea
Please remember, that this board is give & take Smile

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


Joined: 04 Feb 2008
Posts: 9

PostPosted: Mon Feb 04, 2008 11:06 pm    Post subject: Reply with quote

Hm.. Now am understanding... May be if we present application (activities) like a tree then it'll be logically to start activities that are the leaves as subactivities.. May be ))) Nevertheless thank you for the help Wink
Back to top
View user's profile Send private message
plusminus
Site Admin
Site Admin


Joined: 14 Nov 2007
Posts: 2624
Location: College Park, MD

PostPosted: Mon Feb 04, 2008 11:36 pm    Post subject: Reply with quote

Hello crayder,

yes a tree is what it allover looks like, (ok we could link branches of the tree). But we only can go linear, because only one Activity is on the top every time Exclamation (Remember Activity-Stack Exclamation)

So we have something like a chain of dialogs, with some A/B-Decisions (tree style) the what results in a path within the tree.

This works really fine, I'm currently doing it with my [http://www.anddev.org/viewtopic.php?t=740]AndNav[/url]-Application. Everything starts at the tree-root, the menu. To proceed to the Country,(ZipCode or CityName) ,Streetname-Activities, I call a chain of SubActivities after every part of the chain. Doing that it is very easy to go just one step back or, to go back to the Menu-Activity, by chaining the Activities like this:
ActivityC.finish() Arrow ActivityB.onActivityResult() Arrow ActivityB.finish() Arrow ActivityA.onActivityResult() Arrow ActivityA.finish() Arrow MenuActivity Smile

I hope I didn't confuse you Wink

Regards,
plusminus

_________________
Download my apps Idea
Please remember, that this board is give & take Smile

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


Joined: 04 Feb 2008
Posts: 9

PostPosted: Tue Feb 05, 2008 10:22 pm    Post subject: Reply with quote

Wau )))
May be you are cheating? I think you are not a student - you are a teacher! ))))))
Thank you for very good explanation!
Back to top
View user's profile Send private message
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  Next
Page 2 of 4

 
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.