Android is Google's software stack for mobile devices. For non-developer questions, see http://android.stackexchange.com

learn more… | top users | synonyms

0
votes
0answers
16 views

Use less battery with GPS location every 15 minutes [on hold]

I'm implementing an application which need to send a location to GCM every 15 minutes. I implemented an AlarmManager which will be called every 15 minute. Here is my class of my alarmmanager ...
1
vote
0answers
44 views

Getting device's location once in Android

In my Android app I need to get device's location once after user clicks a button. I don't really need to keep updating localization after I get the location coordinates. I created a class which uses ...
0
votes
0answers
13 views

How to read a file line by line in android [closed]

I am trying to read a file with four objects (event name,event location, address and date). I used this code to read the file: ...
1
vote
1answer
38 views

Android Movie Class With AsyncTask

I've got a class called Movie and within this class I use an AsyncTask to get a Bitmap from ...
4
votes
1answer
92 views

Building an application activity

I'm beginning the long process of refractoring an Android app written entirely in SpaghettiJava™. I've been programming for a relatively short period of time (two years), and have tried refactoring ...
3
votes
0answers
43 views

Android Compass

I have made my first app in Android Studio. I made a compass using a sensor-listener. I would greatly appreciate if someone could review my code (it is very short), and suggest improvements. My ...
4
votes
2answers
143 views

Android App Interview (Minesweeper game)

I recently did an Android Minesweeper app for a pre-interview coding challenge before I could talk to any engineer and was rejected. This feedback was given but I'm not sure on some of it. ☺︎ Game ...
1
vote
0answers
69 views

Android calculator app

I am new to android developement. Created calculator application. Want to improve my code quality. Will be helpfull for any advice to make the code better and more professional (overall structure, ...
9
votes
2answers
308 views

Random 5-character token generator

I have an Android app that uses randomly generated tokens to log in. They're 5 characters long, are sent to a user's email address, and have a short lifespan, so I don't think I need anything that's ...
0
votes
0answers
33 views

RxJava: Is there a better way to do this than using a Subject?

In my Android app I have a Service that is periodically polling a server for a music playlist XML. For certain occasions I also want to trigger a reload manually. I am using Retrofit for the server ...
4
votes
2answers
77 views

ThreadPoolExecutor singleton

I'm trying to build a ThreadPoolExecutor singleton to use it across my app. I'm very new to this concept and after going through Google docs I have created this: ...
3
votes
1answer
82 views

Tic Tac Toe Android game

Can you help me with suggestions regarding my code for Tic Tac Toe Game? This is my code, I've tested it and it works, but I feel like it can still be made shorter/clearer. I am not a good coder and ...
4
votes
1answer
54 views

Java (Android) abstract class correct implementation

I am looking for some comments on my code and whether or not this is the best way to create an abstract class. In addition, some of the abstract methods are rarely called so I use the base variables ...
1
vote
0answers
18 views

Android: accessing global data through replaceable instance

I have to access global data shared between activities in Android application. I have simplified DataProvider class to contain only one field - ...
1
vote
0answers
37 views

Fragment-changing in Android

My current code is kinda atrocious to switch fragments and everything, but I don't know a better way to check to see if the fragment I'm trying to switch to. ...
1
vote
0answers
38 views

Simultaneous works with multithreading

I have a case-study for an Android interview. I just wanted to get your opinion before I share the code with the company. There are two fragments: one of them uses a thread-callback structure and the ...
0
votes
0answers
22 views

Adding markers in Corona SDK for Android

I'm having trouble getting the marker added. (only tried on Android devices) I want to add the marker inmediately after the map is loaded. Got it working adding a delay but couldn't make it work by ...
2
votes
0answers
80 views

Map Events From calendar provider to dates in gridview

I working on a calendar app on Android, using roomaorama, which is nice. I am fetching all the events from Events table in Calendar provider once which seems not good performance wise. The library ...
4
votes
1answer
70 views

Speed unit converter

I'm basically a newbie in android app developing. So I'm not sure if this is the right way to write these codes. I have made an app called "Zconverter". It has 9 fragments and the code i m showing ...
6
votes
2answers
252 views
2
votes
1answer
35 views

Asynchronous login form handler

I have an app that user submit the log in form , when it sent the data to server app create a connection for its account. In this connection i have an integer field named as state. the state value is ...
5
votes
1answer
48 views

Android Compound View Usage

I have 2 buttons for Terms and Conditions in my project, that I need to implement in multiple activities. I created the following class: ...
3
votes
1answer
66 views

File reader and streamer component running in its own thread on Android

In an Android project, I have a class whose job is to read lines from a file, and then pump those lines to a message handling thread, looping forever until told to stop. The main operation of this ...
2
votes
2answers
64 views

Commute info entry fragment for Android app

This is a simple app for taking down a user's home and work address, the days of their commute, and the times they go to work and go home. The times and workweek are entered via TimePicker dialogs ...
1
vote
1answer
18 views

Location information (store/send over network)

I have to calculate a user's location periodically and store & send it over the network on Android. I also have to indicate errors during calculation of location as well. The errors could come ...
2
votes
1answer
78 views

Automating heap dumps from an Android device or emulator

I've automated the process of extracting and converting a heap dump from an Android device/emulator. I'd appreciate any feedback and improvements regarding style, bad practices, non-idiomatic code, ...
0
votes
0answers
211 views

Android app with an ActionBar, a ViewPager and an AsyncTask

I'm new at Android and Java development and I've put together a demo app to start learning, which is made of: a main activity extending ActionBarActivity, in ...
11
votes
2answers
450 views

Simple LibGDX Pong game

I created my first java game in LibGDX and it's working fine but I'm 100% sure a lot of my code can be written shorter than now. Does anyone have tips how I can make this code better? Like the ...
4
votes
1answer
166 views

Loading Bitmaps Efficiently

Suppose there is a huge bitmap, huge_bitmap, in the drawable-nodpi folder. I want to create a custom view with ...
2
votes
1answer
220 views

Displaying a list of players and their leagues

My question is mostly directed towards the principles of object-oriented programming. I have an Android application and one of the activities has a ListView. In ...
4
votes
1answer
180 views

Performance optimization on Box2D with libgdx

A few days ago I decided that I wanted to get involved with libgdx. So far I'm blown away by how simple it is to get something on the screen to work with. I'm trying to make a very simple tech demo ...
2
votes
0answers
71 views

Weather application code for API call

I have developed a simple weather application that provides the current weather report based on the city provided by the user. Can anyone help me to improve this code? ...
4
votes
1answer
75 views

Checking alert dialog validation

I have set alert dialog on textview's onclicklistener, and there I have added some items using array adapter. Now what I want to do is check if the user selects an ...
0
votes
0answers
24 views

ResourceProvider is generalization of the ways to obtain objects of some type at the point of their use (when there are several ways)

Often I need to use objects of some type which can be obtained in different ways. For example, list of strings. Strings can be loaded from resources (i.e. using resource id and a Context\Resources ...
5
votes
3answers
294 views

Live character count for EditText

Could you review it and said if it's written good and/or is better way to do that? My algorithm is: ...
2
votes
1answer
105 views

Styling android widgets programmatically

I have code which styles standard Android widgets programmatically (not from XML). The code is working, but I have this bunch of if instanceof else if instanceof ...
2
votes
0answers
204 views

MVC Login for Android

The code for my Android application is below and so far I'm happy with it. Before anyone comments, I do acknowledge it requires the addition of further validation. The android application is a login ...
2
votes
1answer
91 views

Adding items to a database from a dialog

I have a spinner in my activity that upon selection of one of it's options needs to handle the addition of a new object to my ...
5
votes
1answer
106 views

Isprime Android app with kivy

I thought that developing an app in Python should be easier than learning Java. I finally got my isprime app to work but it looks ugly. When I write GUI code I always find myself typing in very long ...
6
votes
2answers
151 views

Strategy Pattern Implementation

I thought I would learn a design pattern today and picked this one. I wrote a simple Android test demo to test the pattern. main.xml ...
6
votes
1answer
121 views

Android game setup

I've been working on a basic Android game these days, but I'm a bit uncertain about my setup and need some advice. The basics of the game are simple: there are characters running on your screen and ...
3
votes
5answers
229 views

Evaluating Valid Date

I want to write a function which returns true if a selected date is smaller than the current date, else return false. This function is working as expected but I want to know the best possible way to ...
0
votes
0answers
213 views

Getting Spotify Metadata and Sending it via Bluetooth

The Spotify for Android application does not support metadata over Bluetooth (to my car at least) so I was looking to build a helper application to detect when the metadata changed in the Spotify App ...
2
votes
1answer
167 views

Design a row in a listview

I want to design a row of the following style in my Android project: I have the following code for this: ...
0
votes
2answers
53 views

Including references in onResume Lifecycle

What's a more concise way to do this? It's way too verbose for my taste. ...
2
votes
1answer
56 views

Getting recent stations

I made a database for my Android app using SQLite and it works fine. However, as I understood, SQLite calls shouldn't be made on UI thread. Is the below okay or not? ...
5
votes
1answer
115 views

JavaCC Android port User Interface (Activity) class

I have been working on a port of JavaCC for Android. It is mainly an interface. I needed only to modify the original source to redirect output to a TextView. The point of this project is to rekindle ...
0
votes
0answers
49 views

Enhancement to Trezor library for Android

I'm only asking because I'm new and don't know enough to have a concrete question. Did I do this correctly? I worked on this until the code performed as expected, but I don't think I'm done. In ...
2
votes
1answer
53 views

Detaching logic from listener implementation in “Smart UI” approach to follow a proper pattern

I took this code segment from existing source on Android, but it applies to anything from ASP.NET Forms to anything else where the UI has an event callback, and the logic is implemented directly in ...