Android is an operating system for mobile devices developed and maintained by Google, Inc. This tag should contain specific programming questions about Android.

learn more… | top users | synonyms

0
votes
0answers
9 views

What is vector<E> how to use in android java [duplicate]

I making game i want use vector into velocity,position and rotation. But i don't know how to wark vector so please help. Thank you
0
votes
1answer
51 views

cannot implement GLSurfaceView.RENDERMODE_WHEN_DIRTY

I'm trying simply to display an openGL surface when I click the screen using GLSurfaceView.RENDERMODE_WHEN_DIRTY mode but the surface does not display when I click it , why ? my Activity : public ...
2
votes
0answers
54 views

Fixed timestep periodical “lags”

I have fixed timestep code in my main thread, it looks like this: float oldTimeSinceStart = 0; float accumulatedTime = 0; float maxDeltaTime = 0.1f; // 10 FPS float fixedTime = 0.016f; // 60 FPS ...
8
votes
1answer
135 views

Will an optional device type specific permission hide my game in the Play Store for those types of devices?

I have heard in many places that if my app uses a permission not applicable to a certain device, it will not show up in the play store for that device. Now, in my code, I am playing audio. I mute that ...
2
votes
2answers
79 views

On Android, why would you handle expansion files yourself instead of using Google Play?

Why aren't all Android games using Google Play's ability to serve their expansion files? Why some are handling it themselves inside their apps?
0
votes
0answers
36 views

Touch and Collisions not working together in AndEngine when i set a custom Physics Handler

I have a set of custom sprites which implement a custom physics handler. The aim is to allow the user to move them by touch, then upon release they should act like a spring is connecting them to the ...
0
votes
1answer
158 views

How do i set gravity towards a point in the centre in AndEngine with Box2D?

I have a scene and i can set gravity in the PhysicsWorld like this.mPhysicsWorld = new PhysicsWorld(new Vector2(0, -SensorManager.GRAVITY_EARTH),false); but i would like all bodies to gravitate to ...
0
votes
0answers
48 views

Is it possible to use a Unity 3d Model with libGDX?

Can I use a 3d model like https://www.assetstore.unity3d.com/en/#!/content/36951 in a libGDX 3d game?
0
votes
0answers
79 views

How can integrate a decibel meter into my Push To Talk (PTT) game?

I have am building a Push To Talk (PTT) game and I need to integrate a decibel meter into it so that I can measure and save the decibel level and identify the peaks (spikes) and add them together. I ...
-4
votes
1answer
109 views

Can we port any game written in C++ with SDL to Android platform or we would need to change some codes too? [closed]

Just wanted to lean a cross-platform library!! Since SDL library supports iOS too..
0
votes
1answer
42 views

Speed from delta time not correct

My game object isn't moving in correct speed calculated from deltaTime bellow. It should reach half of the screen in one second, on any device. Devices: tablet A7600-F - deltaTime = 0.03355443; (...
-1
votes
1answer
47 views

Movement calculation from delta time

I'm trying to calculate object speed from delta time, to get object reaching the same distance in same time on all devices. What I did: while(running) float timeSinceStart = System.nanoTime(); ...
0
votes
1answer
60 views

SDL2 and density-independent pixel

I'm currently using SDL2 on Android and that's my first experience with that library (to be honest, mainly chosen because I'd like to learn it). What is puzzling me is how to deal with different ...
0
votes
1answer
41 views

Using deltaTime

I got deltaTime calculated as 2.7855414E8 on my tablet. How do I get speed for specific device, calibred by deltaTime? For example, if I need object with moving speed, which is about reaching half ...
1
vote
0answers
42 views

The new android studio? [closed]

I got the new android studio, and I noticed one thing when creating a new activity. The layout that corresponds with the java for the activity is made twice, once as a content: This new layout ...
1
vote
1answer
85 views

Different screen sizes? (landscape)

I want to make a separate landscape layout for each size of my original layout I have activity_main.xml. I have adapted it to be able to fit multiple screen sizes: Now, I want to create a ...
1
vote
1answer
54 views

Calculate speed of object for specific device

I have an object - player - which is moving X px ahead each update (updates based on device FPS). From my results, to get average same player speed on all devices, is to do calculation screenWidth / ...
2
votes
0answers
59 views

Sprite animation in Android view

I'm looking for a way to have different sprite animations in individual Android views. I try to use LibGDX and AndEngine but most I could find was how to get an Activity with the sprite animation. ...
1
vote
1answer
118 views

Different screen sizes?

I have looked through all of the android docs and many stack overflow questions, and I have a question on supporting multiple screen sizes. If I have some drawables, I know I need to put them in ...
0
votes
0answers
21 views

AndEngine Font garbled on engine.setScene

I load a font as a member of my main activity with the intent of using the font in two different scenes on the same activity. The two scenes are also members of the mainActivity. public class ...
1
vote
1answer
39 views

Binding tiles with Rect

I'm having trouble binding tiles with Rect. I've successfully bound other objects (such as the player, trees etc) in my game with rectangles but I'm unable to do the same with the tiles and I don't ...
0
votes
0answers
25 views

Layout is different?

I know that layouts can look different on different screen sizes, but I didn't take that into account when I made this layout. So, it is designed for normal screen size, by default, and my phone ...
-3
votes
1answer
41 views

What's the best way to animate games in Android? [closed]

I read up in the android forums different ways to animate, the "drawable" frame-by-frame animation with surface view and the animation using the Movie class and image view. Which one should I ...
2
votes
1answer
86 views

Comparing the images

I have a drawable, which I want to compare to. I created a drawable object with it, and when I log it with toString, I get: android.graphics.drawable.BitmapDrawable@41f95548 I am randomly selecting ...
2
votes
1answer
166 views

Is it possible to use Android Libraries in LIBGDX?

I want to make an android application game that uses both android API like Location, even Google Maps API and also use Libgdx framework as well. Is this possible? I noticed there's an Android and a ...
1
vote
0answers
59 views

Game is responding very slowly?

I have a very simple app which removes buttons and re-adds buttons to certain layouts when a button is clicked. The problem is, this process is taking a very long time. My question is: How can I make ...
1
vote
1answer
29 views

Device model detection and comparation doesn't work

I need to detect device model, and if it is Galaxy Ace GT-S5830i, print it out. But it never print's it (it doesn't get through condition). My code: public String mDeviceModel = android.os.Build....
2
votes
0answers
159 views

unity lag while moving a sprite

I'm trying to build a 2D game for android and after I finished developing the game I noticed that there was lag present when moving objects around. I tested it on a phone much more powerful than my ...
1
vote
1answer
56 views

Prevent button layout changing after one is removed?

I have a layout with four buttons in it. I end up removing one of the buttons using: View v = (View) findViewById(R.id.ViewId); ((ViewManager) v.getParent()).removeView(v); The ...
1
vote
2answers
136 views

Swap buttons in layout

Say I have 4 buttons. I want to have button 2 always swap out with another button, randomly. So, when the user taps button 2, it should swap with another button (randomly). Now, button 2 is at the ...
1
vote
0answers
42 views

How can I move my button?

I am new to animations in android. I was wondering, is there a way to keep a button moving around the screen, bouncing off the walls, until it gets clicked? I was thinking to do something like this: ...
2
votes
1answer
73 views

How can I fix my audio? (prioritize)

When two audio's are played at the same time... the sound is cancelling out. How do I fix this weird phenomenon? I have some code where there is audio on button click and audio in ten second ...
0
votes
0answers
38 views

Two sounds played simultaneously cancel out? [duplicate]

When two audio's are played at the same time...the sound is canceling out. How do I fix this weird phenomenon? I have some code where there is audio on button click and audio in ten second intervals ...
3
votes
1answer
106 views

How do I stop my timer when I close my game?

Background: I have a background service with a timer. It opens up a new activity when 20 seconds are over. Currently, my app is using componentCallbacks2 to detect when the user has pressed the home ...
0
votes
2answers
105 views

Connect phone to computer? [closed]

In order to test out my game, I need to use my real life device. The problem is, android studio isn't recognizing my device plugged in: The problem: My device isn't getting detected in android studio ...
4
votes
1answer
220 views

Multiple inputs for Google Cardboard on iOS and Android?

So far I am having a problem with having only a singular input mechanism (the magnetic trigger) for Google Cardboard games. Are there any other options to augment this in order to have at least two ...
2
votes
1answer
91 views

Calculate average velocity of the object before the game start

I have a game object (player), and with device screen width and average FPS, I'm able to calculate exact velocity for the player to reach whole screen from left to right in a specified time (fx. for 1 ...
2
votes
1answer
416 views

In Unity, on an Android device, CaptureScreenshot writing to Phone, but persistentdatapath linking to the external card

I'm using CaptureScreentshot() to get an image. But when I try to access it on an Android device it's giving me: Could not find file "/storage/emulated/0/Android/data/appname/screenshot.png" When I ...
-1
votes
1answer
42 views

Change Andengine Text By clicking and typing a new text like native android EditText

I have a board in my game, with a name. I want to edit it on a button click (not by text.setText("text") method ) i want the user to enter a text and set it there. I couldnt find, how to change the ...
1
vote
0answers
53 views

How can I detect sprite collisions out of screen?

I am creating an Android game using andEngine library. I have enemies coming from out of the screen into the screen. I already know how to detect collisions, but is there any method I can use to ...
1
vote
1answer
346 views

Calculating delta time

I'm trying to calculate deltaTime, but it's not correct. What's wrong in my code? //declared outside private long timeSinceStart = System.nanoTime() / 1000; private long oldTimeSinceStart = 0; ...
0
votes
1answer
80 views

Game speed on different devices isn't same

I have an app, in which I have constant int speed = 5; On each update, the game object (player) is moving 5px ahead. Problem is, that I can't handle that on different devices - older devices is having ...
0
votes
0answers
80 views

Android onResume called after screen turned off, starting the app running even while screen is off

I'm building a simple 2D game and I am getting strange results and calls the the onResume method when I turn off the phone screen while in the game. So I have two questions: 1. How is the pause ...
4
votes
1answer
145 views

Is there a way to determine Android physical screen size?

We're currently porting our games to Android, and would like to be able to release a universal build for tablets and phones. Is there a way to determine the actual screen size or DPI in order to ...
0
votes
0answers
14 views

Android App Update not automatically installed on devices

I published my app update yesterday and users can manually update it on Google Play, but it should be installed automatically. Does this have anything to do with my certificate? I receive a warning ...
1
vote
2answers
92 views

How can I exclude my enemies from spawning in certain zones generated at random?

I have a code where I randomly generate enemy spawn position, but I want to exclude some areas since it's colliding with some sprites it shouldn't collide with. This is the code where I generate the ...
0
votes
0answers
262 views

Setting Up A Visual Studio 2015 Android C++ Project To Utilise The SFML Library And compile On An Android Device

So in Visual Studio I have installed the cross platform tools to set up a C++ project for Android and iOS such as the Android SDK, NDK and the corresponding USB drivers required to debug the program ...
2
votes
1answer
40 views

Draw lines in game scene [closed]

I want to do game for Android that allows draw lines. These lines should be physic object at the same time. I am good at Unity3D and I tried in Unity3D. But it is not supported. What engine should I ...
18
votes
5answers
2k views

How to compress game frame by frame animation to a minimum on disk

I developing a game like Age of empire (buildings on map) and for every building I have a sprite sheet for its animation. I am using frame by frame animation to animate the building ( not aware of any ...
0
votes
0answers
104 views

LibGDX: open android camera

I need help, I can't find a solution to open camera device in my libgdx app. I'm developing it only in Android for now but I have this issue. I need only to open the preview view, no snap picture o ...