I am looking for a way to do something similar to the image at the bottom. However, I need the selection area to go all the way across and be able to be moved up and down the image via touch. I just need to get the coordinates of the selected pixels.
I am assuming I will need to create a canvas and draw the image background, but after that I'm pretty lost. If anyone can provide an example of something like this, or just a basic walkthrough on what to read up on I would really appreciate it.
Related
I had a question regarding Android programming. I have created an application to take in data via Bluetooth and I would like to use that input as sort of a "game controller" to move an image around a screen. For instance, if the "up" command was given, the image (or even a colored circle) would move a few pixels up.
Can someone point me in the right direction? I thought of using a canvas and redrawing the image every so often but I don't know how to do this and I thought there might be a better/simpler way. I don't need anything fancy.
What i would do. Catch the up command, then have a class lets call it Circle which will hold the current circles position, size etc.
Whenever you catch the up command or left or right or any kind of command, you would redraw the image in that position. I would also use a custom surface view for the drawing and an Activity for catching all the inputs and passing them onto the object.
I would check out
http://www.javacodegeeks.com/2011/07/android-game-development-moving-images.html
and read through the whole series, if you have the time. It is quite a good read.
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.
Suppose I am writing a word "abc" in my GestureOverlayView and while doing so I need to save all those alphabets in the screen until I press a clear button.Can anyone tell me a good way to do this..
I will write "a" which is taken as a gesture (not as stroke) i.e One thing I though of was like use a ImageView or SurfaceView on bottom of a GestureOverLayView.and Suppose when I draw "a" on GestureOverLayView then in the "onGesturePerformed" event it will take the Gesture and then get the strokes and then convert them into paths and then draw the paths onto the underlying ImageView or SurfaceView.Can anyone suggest me the code or guide me.I tried various combinations of them but couldn't solve it..
There's an app called GestureBuilder in the samples directory of the SDK. This app shows how to persist gestures drawn by the user.
I realize this is an old question, but you can "cheat" by increasing the fadeOffset to some ridiculously high number. This can be done either in the xml
android:fadeOffset = "some very large number"
whatever, or programatically,
yourgestureoverlayView.SetFadeOffset(some very large number in milliseconds)
What would be the best way to compare a gesture made on an Android device's screen with a stored gesture? For example, if in my application, I want it so that if I draw a triangle with my finger, the screen will turn blue, and if I draw a circle, the screen will turn red, how could that be done? The only thing I have been able to think of so far is to somehow generate an image file and then compare that to an image of a triangle or circle and check for similarities. But that wouldn't really account for different sized shapes or offset ones. Any ideas on how this could be implemented? Thanks!
There is no need to compare/match the shape of a gesture with an image. The better way is to mathematically guess which one of the recognized shapes did the user draw. http://developer.android.com/resources/articles/gestures.html provides a great reference for implementing gestures.
HTH,
Akshay
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.