Android :: Draw Circle When User Touches Screen
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
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
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
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
Sep 2, 2009
I'm new to openGL and I have done some first tests with drawing a triangle. Now I would like to draw a circle, which is filled with a texture, but I have no idea, how to do so.Can someone of you give me a hint?
View 5 Replies
View Related
Jan 12, 2010
I've created a bitmap that I'm overlaying over another bitmap. I'd like to alter the transparency of sections of the overlaid bitmap, revealing the bitmap beneath. I can't find a way to write only to the alpha channel of the overlaid bitmap.
For example, I have a bitmap filled with red pixels, and an alpha that is 255, opaque. A solid red bitmap. How do I draw a circle on this map that would lower the alpha values toward 0, transparent?
View 2 Replies
View Related
Aug 15, 2010
Hopefully this is a simple one as I've been asking loads recently...
I am trying to draw the a white circle with the following code...
but it is being displayed as a solid disk, how do I get it to just display as an circular outline with a transparent centre?
I've had a look in the help and it makes no sense to me, probably because I'm not used to the drawing terms like stroke and dither. What's wrong with background and border eh?
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
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
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
Aug 26, 2010
My Android application has a MapView. I want to divide that MapView into a grid according to latitude and longitude, and shade the different cells of that grid different colors based upon a certain criteria. What's the simplest way to do this?
I could create semi-transparent, solid-color PNG Drawable rectangular images and put them in an ItemizedOverlay centered on the central points of the cells, but then the rectangles would grow and shrink as the user zoomed in and out on the map. I could extend MapView and override the zoom functions so that the rectangles got re-sized when the user zoomed, but that seems really complicated for something that should be simple! Please tell me a better way to do it?
View 1 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 5, 2014
I have a xi electronics chinese crappy tablet, it came pre rooted. So I changed he cpu governor and I pressed apply, after that it stuck , and I needed to reboot using power and vol -It booted up but now my TouchScreen doesnt respond on my touches!, I have already tried factory reset using adb , didn't work.
View 8 Replies
View Related
Oct 31, 2010
Is there a way to draw on or modify the key guard wallpaper programmatically?It looks simple enough for the home wallpaper, you can use WallpaperManager. But how about for the lock screen wallpaper?
View 1 Replies
View Related
Jun 21, 2010
Yesterday I noticed a small white circle on the screen. It looks like an area on the screen the might be displaying brighter.
View 44 Replies
View Related
Aug 18, 2010
I reduced the number of home screens to one (I'm a minimalist) and it keeps showing a single white circle at the top. Is there a way to get rid of it since it's useless when you have only one home screen?
View 2 Replies
View Related
Feb 8, 2014
I have a sony xperia T and have just upgraded my rom to cynogen mod 11, the only problem is as soon as I went to set it up (which I did manage to complete) I had a blue/white tint circle on my screen. I can move the circle but it is hard to use for example I have to have it on a certain area to click the thing I want to click.
View 1 Replies
View Related
Apr 16, 2010
the "messages" icon on the home screen is a sort of envelope speech bubble looking yoke when there are new sms text messages you get a small green circle over this icon with the number of unread messages in it. how do you clear this?
I hit the icon and get a screen of my text messages none are highlighted in bold to say what's unread AND even after opening them all and going back to the home screen the damn green circle is still there. after a while it goes again?any ideas?
View 21 Replies
View Related
Sep 3, 2010
First post: This is probably a dumb question. Why do I get a white screen with a circle and a gray triangle when trying to view flash content? Example: Zinio or Olivesoftware. Motodroid, Android 2.2, Flash 10.1.92.8 from Market.
View 1 Replies
View Related
Jun 5, 2010
I have a little app that draws moving animations in a surface view. Cute, useless time waster. I think it could be cuter if it were possible to get a surface view that mapped to the home screen icon for the app and animate that when the app is running and the icon is visible. Is that possible? I remember way back in the days of Windows 3.1, that when your app was minimized, it was possible to draw to the minimized icon as though that were the app window (actually, I guess it may just have been the app window). Anyway if such a thing is possible in Android, I'd like to try it. Anybody know?
View 16 Replies
View Related
May 24, 2010
First of all I'm a newbie when it comes to Android programming. So if this question is totally stupid please delete it ASAP Question: I'm going to draw a grid of 10x10 PNG images. Each image is 32x32 px. All of the images are unique. I'm thinking that the easiest way seems to be to put each image in an ImageView. If adding all ImageView's to the layout would this give me some kind of performance hit?Would there be any smarter way to draw these images?
View 1 Replies
View Related
May 15, 2009
Is it possible to draw on the incoming call screen? I know that a few of the whitepages apps do it, but I would like to know how.
View 3 Replies
View Related
Sep 5, 2010
In my android application I use this method in "draw" Overlay class for draw route on map. Can someone tell me if this method is good (in terms of performance) for route draw on map or I must to put code in Thread ??
I'm new to android.
public synchronized void draw(Canvas canvas, MapView mapView, boolean shadow) {
if (pointsAndTimes.isEmpty()) {
return;
}
Projection projection = mapView.getProjection();
Paint paint = new Paint();
paint.setARGB(250, 255, 0, 0);.............
View 1 Replies
View Related
Oct 29, 2010
I'm trying to create a MapView in a service (live wallpaper), but have it hidden so that I can render it to a Bitmap, and then map it to a texture to render in opengl. I have a Canvas and a Bitmap, and I intended to call myMap.draw(myCanvas) in order to get it into the correct bitmap so that I could then bind it as a texture.
When I Initialize I do the following:
myMap = new MapView(ctx, APPSTATICS.MAP_API_KEY);
I get an error:
java.lang.RuntimeException: stub at com.google.android.maps.MapView.<init> (Unknown Source)
Why I can't create a new mapview which I can use to draw to a offscreen bitmap?
View 7 Replies
View Related
Apr 13, 2009
Want to draw a line when I touch screen at two points. I can see OnTouch been invoked but after than everything breaks looks, the application crashes
I am using drawLine in Canvas.
CODE:......................
View 5 Replies
View Related
Apr 5, 2010
I have a custom component which consists of 2 text view and 4 toggle buttons. I want to draw this view at some specific position on the screen. How is that possible?
View 1 Replies
View Related
Sep 7, 2010
In my app I draw an image covering the entire screen. I want to now how can I know where the user touched the screen?
View 2 Replies
View Related
Jul 22, 2010
Can some one show me the sample code to draw a rectangular pulse in android screen. I want to generate a bunch of them on x axis (which I imagine as middle of screen).
View 3 Replies
View Related
Mar 3, 2010
I have had this same problem happen twice to me on 2 different phones on 2 different Verizon accounts!
The password screen locks and when it asks for the user name and password it states invalid user name / password!
Is this a known problem since when I called and talked to both Verizon and HTC the only thing they could tell me was to do a hard reset and they weren't aware of this problem?
View 1 Replies
View Related