Android :: Intercepting Screen Touches During Game

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?

Android :: Intercepting Screen Touches During Game


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 View Related

Android :: Can View Appear At Location Where User Touches Screen

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

Android :: Changing Drawing With OpenGl When User Touches Screen

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

HTC Incredible :: Phantom Screen Touches A Little

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

Android : Application And Have Multiple Images - Need To Switch When User Touches The Screen

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

HTC EVO 4G :: Cheek Touches Screen And Changes Stuff While Talking

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

HTC Desire HD :: Screen Detecting Ghost Touches

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

General :: Touch Screen Doesn't Respond On Touches

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

Android :: Intercepting Incoming Calls

Jun 29, 2010

You can intercept a call on Android?

View 2 Replies View Related

Android :: API For Intercepting And Blocking A Call?

Oct 6, 2009

Is there a API for intercepting and blocking a call? What I want to do is to create app that autometically detect incoming call and based on the caller it either alert the user or don's alert the user. Like, if the number is stored in the phone book then alert the user other wise just send a message to the caller that the person is busy.

View 3 Replies View Related

Android : Intercepting The Back Button

Sep 1, 2010

I'm writing an application which will have two Activities, when the user presses the back button on the second activity a dialog should pop up asking the user to confirm the action. So how do I intercept this? I seriously doubt about this coz the backstack is a part of the OS itself. Has anyone found a workaround?

View 2 Replies View Related

Games :: HD Games - Only 1/4 Of The Whole Game Screen Is Viewed - Liked Zoomed The Game

Oct 16, 2010

I got Samsung Galaxy 5.

I got some gameloft games (HD versions) installed but as I Run them only Top left (approx 1/4)view of game screen appers.

As whole game can not to fitted on one screen..

|--------------------|
| |
| |
| |
|Gamel |
| |
|--------------------

It looks like half of screen is cut like on "oft" of Gameloft is invisible

View 3 Replies View Related

Android :: Intercepting Incoming / Outgoing Email Messages

Feb 26, 2010

I just went through the API and found nothing to intercept incoming and outgoing email messages.

View 7 Replies View Related

Android :: Intercepting - Blocking All Hardware Buttons From Working

Oct 20, 2010

I'd love to prevent hardware buttons from working while user runs my app. Perfectly all of them, but any number would help :) I am not sure it's doable but maybe I miss something, hence my question. For those wondering - "why?" - we got an app that does full screen colorful animation and users often run it and hand the phone to their babies as they can stare at it for hours :) but the problem is, kids accidentally press hardware buttons (usually camera trigger, but also Home or Search - depending on the device model). I'd love to add the option to block all keys beside one which can hardly be pressed accidentally.

View 2 Replies View Related

Android :: Intercepting WebKitView Resource Requests / Serving From Classpath

Jun 7, 2010

I'd like to create dynamic HTML in my app that will also include referecences to a few images. The images should not be resolved / requested by the internet, but instead I would like to somehow intercept these calls and then respond will classpath resources to those requests.I think this is similar how phonegap or titanium do this, but this is just an assumption.Does anyone know how webkit's resource loading can be intercepted and resources can be served from a local cache/ classpath intead of contacting the internet?

View 2 Replies View Related

General :: App For Intercepting Data Connections?

Oct 30, 2011

I am looking for an app that can:

- make a log of all the other apps, including stock ones, that make attempts or actual connections to the internet, and at what time
- be able to intercept those connections
- preferably I would create a white list of apps that are allowed to connect, but others do not have permission.

Purposes include:
- saving on bandwidth in poorer countries where internet is expensive.
- making sure apps or malware doesn't try to send off my data when it shouldn't be.
- prevent annoying background sync/apps from running when I don't want them

I find it strange that we either give all the permissions the app wants, or it doesn't work. Why can't we restrict their internet access?

Does this sound feasible? Does it already exist?

I'm rooted and using an Asus Transformer.

View 3 Replies View Related

Android :: Detecting User's Touches Over An OpenGL Square

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

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 View Related

Android :: Game / Touch Screen Controls

Feb 25, 2010

It would end up looking something like the PSP. You would think that this would be an incredible feature for gamers and any platform that was serious about gaming. Then we wouldn't have to use touchscreen controls, barely passable d-pads, or optical trackballs?

View 3 Replies View Related

Android :: Game Stutters When Drawing Outside Screen

Apr 25, 2010

I have a game built for 480x320 screen resolution. When playing the game on a phone with a higher screen resolution (480 x 800 or 480 x 856) the game automatically stretches to fit the screen which works great. Because of different screen dimensions there is a piece of the screen on the right side (game is in landscape mode) that is black, not used by the game. I want to fill this up with an image, so the whole screen is filled. I only draw that image on screens bigger than 480x320. This all works fine, the image is displayed exactly the way I want to. The only problem is that the game runs less smooth then it used to run. There are small stutters noticeable. When I just draw a rectangle instead of an image the same problem occurs. Does anyone have an idea why this is happening?

View 8 Replies View Related

Android :: How To Stop Screen From Dimming When Playing Game

Dec 17, 2009

In my game because it is a board game, I do not want the screen to timeout which the user is playing my game. Any idea on how to do this?

View 2 Replies View Related

Game For Android - Changing Screen Depending On Orientation

Jan 18, 2012

I am working on a game for android at the moment, and was wondering how i would change the screen depending on orientation.

So if the user turned the phone horizontally then the app would be viewed horizontally if you know what i mean

Also how would i make a timer, so if a button were pressed, how would i say stop for 2 seconds and then go to link?

View 3 Replies View Related

HTC EVO 4G :: Inaccurate Touches In Message Directory?

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

Android :: Game Developing (like Air Attack) Touching Screen Event

Apr 16, 2010

Anyone have download and played the "Air Attach"? In this game,

1.The man can go right when you touch and move finger to the right and can go left when touch and move finger to the left,
2.Touch and release, it is launching a missile

I'm also want to develop a game and have this function, Would you tell me how to implement it?

View 7 Replies View Related

Android :: Drawing Bitmaps On Screen In Game Without Slow Performance

Sep 16, 2009

I want to make a tile based game for android. At the moment I am drawing each tile as a separate bitmap. I have a big for loop that reads from a string and draws different tiles depending on what character it finds to draw the level. I have allowed the user to scroll the screen using scrolling gestures. However the game is too slow. It takes a long time to update the screen after the user scrolls. I presume this is because it has to draw each tile's bitmap individually. What would be a faster way to draw the level? I was thinking I could merge all the tiles into one bitmap. But I don't know how to do this.

Anyway here is my code so you can see the problem:
package org.example.tutorial2d;
import android.app.Activity;
import android.os.Bundle;
import android.view.GestureDetector;
import android.view.MotionEvent;
import android.view.GestureDetector.OnGestureListener;
import org.example.tutorial2d.Panel;
public class Tutorial2D extends Activity implements OnGestureListener {
GestureDetector gestureScanner; Panel main;
/** Called when the activity is first created. */
@Override public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
gestureScanner = new GestureDetector(this);
//requestWindowFeature(Window.FEATURE_NO_TITLE);
main = new Panel(this); setContentView(main); }
@Override public boolean onTouchEvent(MotionEvent me) {
return gestureScanner.onTouchEvent(me); }
@Override public boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY) {
main.handleScroll(distanceX,distanceY); return true; }
@Override public boolean onDown(MotionEvent e) { return true;
} @Override public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) { return true;
} @Override public void onLongPress(MotionEvent e){
} @Override public void onShowPress(MotionEvent e) {
} @Override public boolean onSingleTapUp(MotionEvent e) { return true; } }

And the class that does all the work:
package org.example.tutorial2d;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.drawable.Drawable;
import android.util.Log;
import android.view.View;
import org.example.tutorial2d.Point;
public class Panel extends View {
private int scrollX = 0; private int scrollY = 0;
public Panel(Context context) { super(context);
} @Override public void onDraw(Canvas canvas) {
/*Bitmap scratch; //Drawable scratch;
//scratch = getContext().getResources().getDrawable(
// R.drawable.icon); canvas.drawColor(Color.BLACK);
//scratch.draw(canvas); int origin = 0;
scratch = BitmapFactory.decodeResource(getResources(), R.drawable.horizontal5);
canvas.drawBitmap(scratch, origin, origin, null);
int width = scratch.getWidth(); int height = scratch.getHeight();
scratch = BitmapFactory.decodeResource(getResources(), R.drawable.room4entrynesw3x3);
canvas.drawBitmap(scratch, origin + width, origin - 32, null);
[Code]

View 3 Replies View Related

Android :: Chess Board Mini Game - Navigation Across Screen

Jun 24, 2010

So I was planning on writing a Chess-based mini game as part of a project. I was working on my pitch when I realized that I had to represent 64 clickable squares on a screen of that size. I found a couple of ways around it. Like letting them choose a row number from 1-8 and a column number from A-H OR providing them with four arrow keys to navigate across the screen. But it just takes the fun and intensity out of the game.

View 8 Replies View Related

Android :: OpenGL 2D Game Framework - Speeding / Screen Settings / Vibration

Sep 18, 2009

I've been working on a game framework for a little while, and while its far from perfect, I've put the current version online. To be honest, I haven't used much OpenGL in the past. Before last week I had never tried using it. If anyone would like to take a look, please do, I'd appreciate all the help possible on speeding it up. There are many features I have in mind and am planning at the minute, but so far it supports:

# Texture and Sprite management # Text, using TTF fonts # Organised layers # Two audio management classes, one optimized for music, the other for sound effects # Sprite dynamics (acceleration, terminal velocity, collisions) # Animation # Handlers to manage events fired through movement, animation, screen touches, accelerometer input, device shaking and collisions # Several minor features aimed at speeding development, such as screen settings and vibration.

View 1 Replies View Related

HTC Desire :: Soft / Light Touches Like IPhone

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

KitKat 4.4 :: Phone Spazzing / Recognizing Touches That Aren't There?

Apr 21, 2014

my phone has been randomly spazzing out. I have a LG G2 with 4.4.2

It will slide left to right, open and close apps, etc. without me touching it.

It will go periods of time without doing this, then not stop doing it for a good few minutes. i did just factory reset it, but it is still doing the same thing.

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved