Rotate a view dynamically - android

I have another question related to this disk: http://dl.dropbox.com/u/8051037/disk_ab1.png
I have created a custom view, and set everything up to rotate it, but I don't know how to set the rotation of the view when the disk is spinning. I think I could've done this with an Animation object and a TimeInterpolater, but I couldn't figure out how to use either of those, so I created my own little algorithm for doing it. The code I have can be found at:https://github.com/c0dege3k/StarkOMFGB/blob/master/Mods/LauncherDisk.java.
Thanks for ANY help, this and my other question for this disk have been giving me serious problems.

The easiest way will be to rotate the canvas than to draw the image and restore the canvas. For more info take a look here Rotating a view in Android

Related

Android concertina/accordian/folding animation

I'm trying to create an interactive accordian/concertina/folding animation so that a view folds/unfolds on itself when interacted with - in the same way flipboard folds the view, but both sides fold
The way I thought I could do it was to override the onDraw method, somehow duplicate the canvas or the information on the canvas, then draw the first half of the canvas rotated one way, then draw the other half of the canvas rotated the other way so that they meet in the middle, however I can't seem to grab the information from the canvas! Is it possible to grab a bitmap/snapshot from a canvas?
The only other way I think it's possible to achieve this kind of animation is with OpenGL.
Any help are greatly appreciated.
EDIT heres a good example of what i want to achieve http://www.nytimes.com/interactive/2008/03/28/arts/20080330_FOLD_IN_FEATURE.html
check this archive to acheive fold animation
code: http://developer.android.com/shareables/devbytes/FoldingLayout.zip
modifies it to make it work for lower version up till API level11

When using surfaceview, images are not visible but they are drawing on view in android

I am drawing some bitmaps in canvas in which my class is
extended by view, then everything is working fine but I found that
efficiency is lacking in this. So i have searched for other
alternatives and found that we need to extend class to surfaceview
inorder to increase efficiency. So at present I am drawing bitmaps
using surfaceview. But here is the problem, when I changed and run the
program I am unable to see the bitmaps but the onDraw() is called and user touches are being handled by my view. I
have done some searching in this but couldnt found anything. Can you
please let me know eventhough the images are being draw on to the
view, why the images are not being displayed???
Thanks

How to paste stuff over a camera preview on Android?

I am making the classic AR app for Android.
I am using a SurfaceView to show the camera.
I want to know, how I put things over it... Currently I am using widgets, but they have two issues:
First, they are slow.
Second, you cannot rotate them in 1.5 without using view animation, and noone I asked so far (here, forums, google, irc...) knows how view animation work, so I am failing to make the view animation work in sync with the custom view that put widgets over the camera (resulting in flickering).
Thus I decided to change the method of putting things on the screen, so what other ways exist? (note I am bound to Android 1.5)
Seemly it cannot be done easily, but I could put a image and rotate it easily using Matrix.
I basically placed on layout over the preview a ImageView, then I used setMatrix to a rotation matrix, and voilá, I got a rotated image that works in 1.5
You must use OpenGL for drawing Objects over your SurfaceView.

How to get pictures of the camera preview, before its Callback draws theese pictures to its holder?

I really hope you guys could help me, because I couldn't find no solution for my task since 2 weeks now, neither by searching, nor by myself.
What I'm trying to do is to get the camera-preview-pictures in bitmap format, before they are drawn to the camera-preview's surfaceView!, then I want to manipulate the bitmap with computer-vision-algorithms, and eventually draw them on the camera-preview's surfaceView.
I'm able to get YuvImages from the camera-preview using the callback's onPreviewFrame()method, further I'm able to manipulate them as needed and I'm able to draw pictures on a surfaceView using a thread. But I can't figure out how to combine those tasks.
The problem is that the preview's callback automatically draws it's pictures to its surfaceView, so when I get the pictures in the onPreviewFrame() method, they were already drawn to the surfaceView. How to change this behaviour?
I could find no solution. I thought it might be a workaround simply not showing the preview's surfaceView, but another one, where the manipulated pictures are drawn on, but I couldn't get this solution working either...
I hope you guys could help me, because I'm already frustrated.

Making a draw/paint app

I'd like to include a simple draw feature on my app. A friend told me I can't use canvas because I need to control the frame buffer and not redraw the entire screen every for every frame. He suggested I find a openGL 2d engine. I've searched around and I've only found Rokon which doesn't have any documentation and the examples aren't quite what I need.
Any suggestions?
I don't really understand what the problem is?
If you simply wish to redraw some portion of the canvas you can use invalidate(rect).
http://developer.android.com/reference/android/view/View.html#invalidate()
Just create a custom veiw by extending the view class. in this custome view override the onDraw method. Android itself takes care of the pixels that have been changed and calling invalidate only refreshes the pixels that have been marked dirty

Categories

Resources