Android :: Rotated Map View - Get The Touches Back To Where They Belong
Feb 24, 2010
I am using the MapsDemo example for a mapping application where I rotate the map in direction of travel. This works well even without the canvas smoothing in the example.
However, I haven't yet managed to adjust the dispatchTouchEvent code to counter the map rotation effect for the user touches (right now when the map is rotated 90 degrees a user's horizontal sweep will move the map vertically etc). The sample code only offers the teaser:
CODE:..........
And while I am at it - Is it still possible to position the zoom controls separately, so that they do NOT rotate when the map rotates? I read that the getZoomControls() is deprecated.
View 2 Replies
Nov 19, 2010
I'm new to android development. Is it possible for a view (with a particular layout) to "appear" at the location where the user "touches"? If so, how? Like the idea of right-clicking on your computer - a menu pops down wherever you right-click and when you navigate away, it disappears.
View 1 Replies
View Related
Mar 7, 2010
I have create a subclass of View and overwritten onDraw() - see some test code below. It draws a line consisting of some points. Before the line is drawn the canvas is rotated and restore after the drawing. The angle by which the canvas is rotated increases by 5 degrees every time onDraw() is called. The view is invalidated about once a second causing the view to be redrawn. Due to the rotated canvas the line drawn looks like a clock hand rotating counter-clockwise. This works - but not always. Sometimes the line is not drawn for one or more seconds, although I know from the log statement that onDraw() was called. Sometimes means: The line may be not shown after 8 seconds, then again after 35 seconds and so on. If the canvas is not rotated the problem does not occur. This also happens when I use a SurfaceView instead of a View. It does not only occur in the simulator but also on my G1 - both using Android 1.6.
CODE:.............
View 2 Replies
View Related
Sep 30, 2009
something weird is happening when i inflate a particular view and i wonder whether i'm running into some kind of namespace collision inside the resource/class space.i have a few custom views in my app and generally i park them in discrete XML files. the views are declared.
View 3 Replies
View Related
Jun 15, 2010
What's the best way of intercepting screen touches and coords during a game loop? At this point, I don't have a View from my main.xml file, so the normal OnTouchEvent doesn't apply, as far as I can tell. What's the usual procedure for this?
View 2 Replies
View Related
Nov 11, 2010
I'm developing an Android application.I'm also working with OpenGL graphics.I have a square drawn on the screen and I want to let user move it when he touches over it. In other words, user should be able to move square when he puts his finger on the square.If he touches outside the square nothing happens.How can I detect when user touches over square?
View 2 Replies
View Related
Aug 1, 2009
I've this code:
Java: (http://nopaste.me/4449 )
package com.patrick.games.whackgroundhog; import android.app.Activity;
import android.content.Context; import android.graphics.Canvas;
import android.graphics.Color; import android.graphics.Paint;
import android.os.Bundle; import android.view.MotionEvent; import android.view.View;
public class Game extends Activity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); setContentView(new Ground(this));
} class Ground extends View { public Ground(Context context) { super(context);
} public void onDraw(Canvas canvas) { canvas.drawColor(Color.BLACK);
} @Override public boolean onTouchEvent(MotionEvent event) {
if (event.getAction() == MotionEvent.ACTION_DOWN) {
//TODO: draw the circle } return true;
} } }
View 2 Replies
View Related
Nov 10, 2010
I'm developing an Android application. I'm very new on it. I have the following classes:
class CustomGLSurfaceView extends GLSurfaceView
class CustomRenderer implements GLSurfaceView.Renderer
CustomGLSurfaceView uses CustomRenderer to render a cube on onDrawFrame method.
I've added an onTouchEvent(MotionEvent event) on CustomGLSurfaceView to manage touch events:
class CustomGLSurfaceView extends GLSurfaceView {
// For touch inputs - previous touch (x, y)
private float previousX; private float previousY;
private CustomRenderer myRenderer; public CustomGLSurfaceView(Context context) {
super(context); myRenderer = new CustomRenderer(); setRenderer(myRenderer);
} @Override public boolean onTouchEvent(MotionEvent event) {
float currentX = event.getX(); float currentY = event.getY();
switch (event.getAction()) { case MotionEvent.ACTION_MOVE:
myRenderer.handleMovement(currentY, currentY, previousX, previousY);
} // Save current x, y
previousX = currentX; previousY = currentY;
return true; // Event handled } }
May I have to modify onDrawFrame to draw something new or to rotate the cube? I thing I must do it on handleMovement.
View 1 Replies
View Related
Dec 29, 2009
I am using ViewFlipper for my application. I trying to make it.when user pressed on escape (back) button, it would be back to parent Layout.
View 3 Replies
View Related
Dec 11, 2009
Am creating a small application In View Page am doing update and delete operation from database am displaying data s in the top (ex 10 records) and bottom i have 2 buttons Edit and delete if user clicks Edit button it redirects to Edit page In Edit page i am displaying content for editing also i have 2 buttons update and cancel if user click update again am redirecting(using start activity) to view page It is not displaying new records. i went back to main page and then i clicked view page now it is updated How to solve this ??? Another problem is At the same if user clicks back button it is going all page which i went (through redirected page)
For example First i clicked view page from main page in view page am doing edit and delete operation after completing this it goes to view page Here i am clicking back button it is going previous page that is edit or delete page which i have performed last I need to go main page from view (after performing edit or delete op) How to do this ?
View 1 Replies
View Related
Feb 4, 2009
Here is the problem, I am building an application and have multiple images that need to switch when the user touches the screen, doesn't matter where the users touches. The press the screen and the images switch randomly. I purchased the ebook "Professional Android Application Development" and have torn though it. I am stumped. I'm thoroughly confused at this point. Any ideas on where I can go or how I can accomplish this?
View 11 Replies
View Related
Jun 5, 2010
I have a TabActivity with several tabs. Each tab corresponds to a specific view, and those views may further switch to other views. For example, one of my tabs displays RSS feed list, after user clicks one of the RSS feed, it will switch to a view displaying a list of articles, and after user clicks one of the titles, a full article view will be displayed.I'm going to add support for "back" button in my application. For instance, in a full article view, after user presses the "back" button, it should switch back to the article list view. And if user presses it the "back" button again, my application should switch back to the feed list view.My idea is to maintain a Stack<View> during navigation, and every time user presses the "back" button, the program will pop a View out of the stack, and set it as the current view. But I would like to know how to set current view in TabHost.
View 1 Replies
View Related
Sep 3, 2010
I want my view to change when it has changed to horizontal orientation code...
This works, but I want my layout to switch back when it is in portrait mode.
View 2 Replies
View Related
Nov 3, 2009
I have a weird problem on progress dialog: I have 2 views: Login View and say, Display View. In Login View, when I click the 'Login' button, a progress dialog is created (new ProgressDialog(...)), shown and stored in a variable 'mProgressDialog'. After login, the dialog is dismissed and some information are displayed in Display View (Login View hides). Now I want to display another progress dialog when 'Update' button is clicked and when the update is done, dismiss the dialog and display new information. So I use: the Display View for a blink and then shows the Login View. I tried to change the view etc. but same problem happens over and over again. So I am thinking it might because one activity can only be assigned to ONE progress dialog and no matter how you re-create it you still get the same progress dialog. And the dialog is linked to a certain view which will be shown automatically when the dialog dismisses.
View 8 Replies
View Related
May 9, 2010
I want to show an arrow that indicates the direction towards a goal, using the orientation sensor and current GPS position. Everything works well, except that I want to rotate the arrow image in my ImageView.
View 2 Replies
View Related
Nov 24, 2010
I need to put some text over an imageview.
CODE:..........
But this doesnt displays the text only the picture. And also I have to rotated this text. Is this even possible with TextView?
View 1 Replies
View Related
Apr 29, 2010
Mine just started registering phantom screen touches a little while ago.It seems to think there is either and up-swipe or some kind of touch near the top of the screen randomly. For example, an email or list will constantly be scrolling up or if I leave it on a screen with Power Panel on it, one of the icons will randomly highlight orange. The page with the google search widget will have the search field highlight orange on it's own too. When entering text, the cursor will randomly jump back to the beginning.
View 6 Replies
View Related
Nov 5, 2010
Anyone notice a change since the last update with inaccurate touches in the TM directory?I've lost count on how many times I'd touch on one person to text and it brings up someone completely different.
View 6 Replies
View Related
Jun 8, 2009
When camera is launched in portrait mode, the viewfinder screen is 90 degrees rotated and stretched out. I read couple of places that this is a known bug with sdk1 but i am still finding this problem with cupcake. Has anyone having any idea is this issue is fixed in cupcake or in donut? any clues how to move ahead. setOrientation and changing the preview size didn't help. Even I read somewhere Surface flinger class needs change: http://groups.google.com/group/android-framework/browse_thread/thread...
View 3 Replies
View Related
Mar 14, 2010
I am having trouble finding information related to which i should choose, OpenGL ES 1.1 or 2.0 for 2D graphics.
OpenGL ES 1.1 on Android is a bit limited to my knowledge, and based purely on sprite count the only useful renderer is draw_texture() (as far as i know). However, that does not have rotation and rotation is very important to me.
Now with the NDK adding support for OpenGL ES 2.0, i am trying to figure out if there is anything that preforms as well as draw_texture(), but can handle rotation.
Anyone have any information on if 2.0?
View 2 Replies
View Related
Oct 5, 2010
I would like to display some UI Elements on a android xml layout file. I try to make an application, where two players can sit at each end of the mobile device, and play against each other.
So need to show some Button 180 degrees rotateted.
Is this possible? I tried android:gravity, but this did not work.
View 3 Replies
View Related
Jun 11, 2009
I am using the code from ApiDemo Camera Preview and it runs fine on my Gphone but the preview is rotated and stretched.
View 8 Replies
View Related
Sep 23, 2010
I plan to get an HTC Desire soon and have one last question on mind.The best phone I've used so far is the iPhone. If anyone's used/compared the iPhone and Desire with a hands-on experience, could you please let me know how well the touch sensitivity/responsiveness of the HTC Desire compares with the iPhones? i.e. does it respond as well to soft/light touches as the iPhone does? Also, how well would you place the touch sensitivity (good, better, best, equal) for Apple iPhone, HTC Desire, Samsung Galaxy i9000, if you've personally experienced all 3, or any 2 of them.I haven't been able to get my hands on one unfortunately. This seemed to be the only way left to find out.
View 9 Replies
View Related
Jun 24, 2010
I've never had a smartphone YET, but my daughter has a Droid and says she hates that when talking on it, her cheek touches the screen and changes stuff while talking. She's new to the phone itself, so is she doing something wrong or is this just a con of smartphones? Or is this a Droid thing and not an EVO thing?
View 13 Replies
View Related
Nov 24, 2010
After much waiting for my desire HD I was (and am) really pleased with it. However in the last couple of days my screen appears to be detecting a second touch which pretty much prevents me playing games and is a real hindrance when typing. I could accept this if it were the gel protector or my hand running over the side of the screen, but it seems to be around the "rtuio" bit of the keyboard when holding the phone in portrait mode (i.e. the centre). I do have a screen protector on there but there are no air bubbles or anything visible underneath it. So yeah, has this been raised before? I couldn't find anything. Do I need to recalibrate the screen somehow?
View 1 Replies
View Related
Apr 7, 2010
I have a views on the main class and many other class with an onDraw() method to draw a canvas.
Java:
CODE:.....................
View 3 Replies
View Related
Jun 15, 2010
I would like to know as to what will happen to the thread which has been created by an activity and the device is rotated. I have observed that the onDestroy method is called when this happens. Will the thread be killed too?If the thread is not killed, how can I reassociate the thread with the activity as a new instance of the activity is created on rotation.
View 1 Replies
View Related
Jun 26, 2009
I am getting a crash intermittently when my Activity starts up either initially or when the screen gets rotated I get several log messages which I have been unable to get any insight from: timeout expired mFreezeDisplay=1 mFreezeCount=0 App freeze timeout expired Force clearing freeze then lots of: Lock_layer timed out (is the CPU pegged?) Key dispatching timed out then I get ANR annotation: keyDispatchingTimedOut the trace has alot of sending signal 3 to alot of PIDs
View 2 Replies
View Related
Jan 25, 2010
I am finding that performance degrades after one or more screen rotations, and I presume that this is likely to be because an App's main Activity is destroyed and recreated each time the screen is rotated and that my app must be leaking memory when that happens.I have read that, contrary to what one might expect, not all the objects created by an app's main Activity (or in classes called by that Activity) are destroyed when the activity is destroyed. Specifically, I think I have read (although I can't now find where) that if the View uses a large bitmap member object then the Activity's onDestroy() method should be over-ridden and the bitmap should be explicitly recycled.Are there other objects that need to be destroyed or removed when the Activity is destroyed? What about Listeners? Is there a comprehensive tutorial or guide on this subject?
View 1 Replies
View Related
Apr 18, 2010
I have tried to freeze orientation: setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
But thought screen stays in portrait orientation, the activity is still recreated.
View 1 Replies
View Related