Best approach to develop a GPS like application - android

I'm new to android and I'm starting to develop a GPS like application for android, the basic concept of the app is to show up a blueprint, and display on top of it pins with information related to the position on the blueprint and other settings.
An example of this would be taking a blueprint of an apartment which you can scale and pan, and on top of it place markers with information about each part of the apartment and obviously positioned in the right places like bathrooms, bedrooms, kitchen, etc.
My question is what is the best approach to develop this kind of functionality?
My first thoughts were to use a RelativeLayout as a container, an ImageView for the blueprint with zoom and pan capabilities and individual views for the pinning with the respective place for information positioned based on the zoom and pan of the image.
Then I kept digging and saw the 2d Graphics option but I don't really know how to implemented for this.
I'll appreciate if anyone can send me in the right direction and if is possible some examples as well.
Thank you in advance.

Use a MapView with an ItemizedOverlay to display the markers. Here's a step-by-step answer how to accomplish this (See Item B of the answer).

Related

How to create infinite scrollable and zoomable view android?

I am very new to android programming, and I want to create a large infinite scrolling and zoomable activity where I can add views much like the empty activity we get in the Simple Mind app. Which layout and activity type should I use? What we the best way to implement this? Any help or pointers to tutorials are welcome.
No view in Android is infinite, you're going to run out of memory at some point. The solution you choose will depend on how interactive you need the zoomed view to be.
You can check out android pinch zoom for previous discussions on this topic.
If you're just looking at displaying information and not editing then I'd suggest custom tile maps for google maps.
https://developers.google.com/maps/documentation/android/tileoverlay
I've seen it used before for very high resolution viewing of paintings.

Android: Custom region map

I am trying to implement a map(not Google maps) like in the below image, which will have a hypothetical regions(not administrative) with different colors to indicate the population density. The regions will also be clickable and cliking on that will open a small info overlay.
For now I have the sliced images for each region with multiple colors (which color to be used is determined from an API request). But I am not exactly sure how can I implement this in Android? I've been doing some research for past couple of days but couldn't find anything satisfactory so far.
Things that I am having trouble to implement:
Put together all those images and form the map
How can I detect "tap/click" event in the regions
In one brief conversation with a guy, he mentioned something of "greyscale overlay-map, that is not visible to the user and which determines the right area by testing against the greyscale color index", frankly I didn't understand what he meant.
Here's what I am trying to achieve:
Any help or pointer to the right direction would be of great help.
Thanks for your time.
Check out www.trimaps.com, I think this is what you want. Sadly it isn't free.

set the origin (x,y) of a view inside of a RelativeLayout

I have some game pawns on a screen inside of a RelativeLayout. When the user clicks the pawn I would like then to be able to drag it under there finger. I have the MotionEvent captured but can't seem to find how to adjust the orion of the pawn.
I've seen posts saying to adjust the margin but that seems questionable. I still want to do hit tests for the pawns after they've been moved and don't understand how to work with the margins in that case.
thanks!
I would recommend not using a Relative Layout at all.
A Canvas is a much better option
Or if you really want to use a layout, possibly an AbsoluteLayout is a better option
Using a layout for a game may prove unsatisfactory as you proceed. I can recommend using the free and open source game engine AndeEngine for making 2D games. The problems you have with collision detection and x,y positioning are trivially easy to implement with it. I've made 2 games and a visualization view within an app with is so far.
Check it out here:http://www.andengine.org/
You can download the demo app to your android device and see its out-of-the-box capabilities. (They include Sprites, sound, animation and more.)
This one game I made with it.
https://market.android.com/details?id=com.plonzogame&hl=en

Android components for displaying a graph (nodes and edges, in 2D)?

I'm at the starting point of developing an android app similar to a "mindmap" program (like Thinking Space). It shows some graph nodes (containing text, maybe images) and edges that connecting them. I can take care of graph algorithms, but I have two uncertain points about Android components for displaying these things:
The expanded graph will be pretty big, so the user need to be able to scroll both vertically and horizontally. I looked at ScrollView and HorizontalScrollView but they can't scroll both vertically and horizontally. So I hope to know which top level container I should use.
I also want the graph to be zoomable with pinch gestures, so that the user can zoom in to a small part of the graph. But I also want the graph nodes to be interactive, so the user can tap on them, typing text into them and move them with fingers. Should I implement each node as a separate View object? If so, how do I make all the nodes zoom together?
Thanks.
I would definitely rely on custom views for this kind of things, they will give you much more freedom and efficiency than using standard layouts.
Implementing a scrollable view is quite easy, and implementing the pinch gesture will be much easier if you're supporting API >= 8 (see ScaleGestureDetector). Making graph elements interactive and editable would be another thing, though.
Something really much better could be creating a custom layout, that would host editable graph elements (custom views) and draw their relations. It would be much more elegant, clean, expandable, maintainable and reusable, but it would need a lot more designing. Yet I'm sure it would be greatly rewarded.
(This would be quite an ambitious project for me, so... good luck!)

Custom layout in Android: scrollable graphic with selectable elements over top

I'm fairly new to the Android platform and was wondering if I could get some advice for my current head scratcher:
I'm making an app which in one view will need an image, which can be scrolled on one axis, with a load of selectable points over the top of it. Each point needs to be positionable on the x and y (unlikely to change once the app is running, but I'll need to fine tune the positions whilst I'm developing it).
I'd like to be able to let the user select each point and have a graphic drawn on the point the user has selected or just draw a graphic on one/more points without user intervention.
I though for the selectable points I could extend the checkbox with a custom image for the selected state - does that sounds right, or is there a better way of doing this? Is there any thing I can read up on doing this, I can't seem to find anything on the net about replacing the default images?
I was going to use the absolute layout, but see that it's been depreciated and I can't find anything to replace it.
Can anyone give me some code or advice on where to read up on what I need to do?
Thank you in advance
This really feels like something you should be doing with the Canvas and 2D graphics, rather than trying to twist the widget framework to fit.

Categories

Resources