I have a couple of images on available to my program. They are parts of jigsaw puzzle (with rectangular pieces though). I wanted the look and feel similar to that of google maps in android.
One way I could implement was to create a set of ImageViews and keep recycling them, as the user pans the image in any direction. However, to me that appears like a brute force method. Is there any alternative approach to implement such kind of application?
Or rather how is google maps implemented? A set of Imageviews ?
I think for your case the OpenGL route might be the best choice. You can get started with the GLSurfaceView.
Using set of images and recycling them is a valid method. But you can enhance it by adding some redundant ones to keep close to view area images preloaded.
Related
I'm writing an app which allows the user to change the colour of countries on the world map by tapping on them. At the moment I'm struggling to find the apt way to store and display the map, allowing it to be partly coloured at the same time.
On of the solutions I had in mind was to use an SVG and a third-party library, but as far as I know none of them provides the necessary callback to modify the image once it's drawn.
I am merely at the beginning of understanding of what Canvas is, but even now it is clear to me that drawing such a complex object as a world map on Canvas is way too hard. It will probably take ages to load as well.
I have not implemented any of the mentioned things yet. I assume there is a better way that most developers use, so I'd like to find out what it is.
After more than a year I have finally found a working solution.
Google Map's Android API Utils provide a great means of applying various overlays to Google Map views and fragments as well as changing their individual components.
I went with a geojson layer upon the map and updated the fill colour of certain features.
I have am developing a game in which most of the sprites are static (but animated). I found that using an imageview with drawable background (using xml) is giving me what I want. I may move those sprites based on user touches and have basic collision detection.
When I search the internet about the game development, most sites talk about either game engine or at least canvas/surface view. However in my case, I find deal with the normal android views and layout is enough to get me to going.
Is making a game using layout, image views and views something that is frown up? am I going on the wrong path with this?
Thanks
It all depends on the kind of game you want to make. If you are making a grid based game, ImageViews could be more useful. However, almost no one makes Android games using layouts. Most people choose to use SurfaceView because it allows much more to be done, and in my opinion if you choose to learn it you will make much better games.
Of course, this is all opinion but I know nobody who creates games using the layout editor.
Just to clearify....I dont think I can use google maps unless it will automatically scale custom Images I need to use when the map is zoomed.
Im trying to create my own custom view to use to display images of maps that will be zoomable and also allow the user to leave markers where they touch....maybe via longtouch with a single press or if I can manage it just via single touch.
How ever Im having a little trouble trying to figure where to start. So far I have a couple different implementations of zoom-able imageviews which work fine but I havent been able to come up with the math to allow the markers to move to their correct positions relative to the zoom level when a user pinches and zooms.
I have come across a similar solution to what I am trying to do on here before but of course now that Im looking for it, its no where to be found.
So my question is how would I go about mathematically figuring out where to draw my markers according to zoom level? Does any one know of any libraries or opensource projects that do such a thing already? Any help on the matter would be greatly appreciated.
I am programming an android game that has a screen, which has a ScrollView that contains almost everything on the screen. I need to have image elements that move around, can be clicked on (but also be transparent to clicks in certain situations) that have multiple layers and animations.
Should I use layered Imagebuttons? there can potentially be doezens of them on the screen at once, and i don't know if there are memory concerns about having 200 imagebuttons on a screen.
Do I need to use a canvas? I have seen canvases in many examples, but i don't know if they are the best option.
Is there some other class or way of doing this that is better?
any help you can provide would be much appreciated.
You'd be best served by an Android game library. Check also e3roid.
I'm thinking about writing a pretty basic game, which mostly involves sliding images around on the screen when tapped. So tap an image and it slides to one side. Doesn't seem like Android Animations will help me here since those don't actually move the images, just makes it appear moved.
So even though this seems like pretty basic functionality, it seems like I have to write a game loop,etc and implement my own code to handle the "animation" (including some acceleration/deceleration), etc. Not hugely hard or anything, but just seems like overkill. Also using a 3rd party game engine also seems like overkill, just in the time it would take to learn that, and so on.
Am I off base here?
If anyone has any suggestions that might get me pointed in the right direction (links, etc) that would be great. Is there a good way to use Android Animation functionality in this case that I am missing?
If you are developing for Honeycomb, it may be as easy with animations. With Honeycomb, there is a whole new strategy to animation. Check out the blog. The premises is that any property or value can be animated, and that includes the view's actual position (and not just look like it moved).
I have built a couple of games using AndEngine (http://andengine.org) I would recommend it for making games for android. And since it is all written in java, it is relativiely easy to integrate it with layouts and other activities.