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

learn more… | top users | synonyms

7
votes
1answer
67 views

Perfect game loop

I've been working on development for an Android game, and this is the game loop I have so far: ...
9
votes
1answer
66 views

Why does the new ADT create a static inner class Fragment by default?

Honestly, I can't help but feel that this is done merely to confuse newcomers. Most of the errors on Stack Overflow by complete Android newbies mostly stem from that they have a static inner class ...
1
vote
1answer
65 views

Null checking in nested getter calls [closed]

I have the following piece of code and I would like to see what different approaches would be to solve that in a more elegant way. The thing is that I don't know whether is better to have the null ...
3
votes
2answers
176 views

Locate user of an Android device

I am new to oriented object paradigm and I work on Android using Java project for an internship. I must be able to locate the user and some around buildings I read stuff about how to setup ...
5
votes
3answers
740 views

Class for catching error and logging

I often write something like this in my code: ...
5
votes
1answer
35 views

Using SQL to reorder items in a list view - is this efficient?

I'm writing an application for work that requires me to process a list of transactions. The list is small (5 records at the most) and I'm required to display that data in an android ...
4
votes
2answers
63 views

Custom grid view with different columns

I am developing a custom grid view with different columns. EDIT: Here View Possibilities Mockup Here is the full demo. You can directly use it, with Internet uses permission. This works ...
10
votes
2answers
379 views

Create albums out of songs

I have made a method which returns a list of all songs on my device. Now I want to get a list of albums out of these songs. What I basically do is go through every song I have in my list, check if ...
3
votes
3answers
209 views

Run different methods in background threads without duplication

In my Android app I have number of methods that should be executed in a background thread. One of the methods looks like this ...
6
votes
1answer
43 views

Searching for songs on an Android application

In my application I need to search for some songs on my external storage card every now and then. On startup I read everything, however when it comes to new activities I thought I could just pass the ...
4
votes
2answers
51 views

Android global data

I have a huge list of song objects in my program and I need those objects in almost all activities. Well, at least a part of it up to everything. So I created a class which looks pretty much like ...
0
votes
1answer
26 views

Touched events created in a for loop [closed]

All I want is a simple "yes/possible" or "no/and that's bad coding". I have a card game I'm making and looking through your discard pile is a big part of it, so it's going to be constantly growing. ...
7
votes
1answer
44 views

BananaQuery - Android one-line query

I created this library just for fun. Since I was a bit tired to write 10 lines of code to execute a simple select query in Android, I created a way make it simple. It's not so advanced and some ...
6
votes
2answers
62 views

Passing listener to customized extended View in Android

I extended NumberPicker with several methods needed in my application. When I came to defining a OnValueChangeListener this is ...
3
votes
1answer
42 views

A generic MVC ArrayAdapter class

Like everyone, I use ListViews in a lot of apps. And I pretty much always end up making a custom Adapter. Yet 90% of my custom adapters end up doing the same ...
5
votes
1answer
75 views

Sprite is Refreshing

I am using "AndEngine" and I would like to know if I am following the best practice when I want to refresh the entity. Let say, I have 2 sprites and I want change them into 2 another sprites. I ...
10
votes
3answers
72 views

Optimization of aStar in Java

I'm currently looking to optimize my aStar algorithm as my last run through took roughly a minute to generate one path. I've never had to optimize before as I've never run into performance issues, so ...
2
votes
1answer
86 views

Efficient and fast way to send data from Android to server

I have an app that will be sending images ranging from few KB to ~20MB and I need to write a code that will do that in the fastest and most efficient way. I currently have a code that does this, but I ...
7
votes
1answer
143 views

Unit conversion activities

Please review these activities which handle converting units in an Android app: I would appreciate any guidance and advice on code refactoring and different design patterns or strategies that I ...
2
votes
1answer
52 views

ListView with a search filter

I have this piece of code I've been working on for quite some time. It's a ListView with a search filter. Inside each row, it contains a user Image, a User's name and how many friends they have in ...
0
votes
0answers
34 views

Improving equal spacing between elements in layout

I am trying to make a nice set of items, which are equally spaced from each other. On example below, I set buttons between empty textview. Every button and text view has height = 0dip and weight=1. ...
2
votes
2answers
181 views

Generic HTTP using Android Asynctask

I have developed a generic HTTP functionality using Android Asynctask and Apache HTTP client. Please review the code and let me know if it is the right way of doing or there are other ways to achieve ...
1
vote
1answer
37 views

Reducing imageview buttons code

This code is very long, and you need a separate method. How can I implement it? I have 6 (x2) imageview buttons and 6 edittext. ...
6
votes
1answer
52 views

Delete (Reverse Backspace) Button

I have built a delete button in Android, just like in Windows, which removes the string on the right hand side of the cursor (one by one). (Instead of the mainstream Backspace which removes the left ...
6
votes
2answers
107 views

Create and organize some classes (hierarchy)

I'm trying to figure out what is the best way to create some objects in my application. The application is already running, but I want to structure things well and clean. These objects represents ...
3
votes
2answers
50 views

Callback on AlertDialog

I am using an AlertDialog in Android, asking the user for some input. I would like do run some code when the user has finished entering her input. Since an ...
2
votes
2answers
66 views

Populating a ListView via a php script in Android app using AsyncTask

This class retrieves JSON data from a PHP script and uses the data to populate a ListView using AsyncTasks. Any ideas on how to improve it? ...
0
votes
1answer
67 views

Retaining and passing data between Activities [closed]

I'm making an Android app where users can create posts. This process of creating a new post can potentially be a few activities/screens, so I need a way to save and pass the data between the ...
2
votes
0answers
56 views

Parcelable Bitmap with the intention of uploading the bitmap

I could really use another set of eyes on this. No one else in the office has a lot of experience working with Android, so I'm on my own with this one. The goal of this class is to encapsulate an ...
3
votes
2answers
52 views

How can I speed up my RSS feed Android App?

I have a problem with parsing RSS from a PHP page because the app is too slow. This is my parsing code: ...
5
votes
1answer
76 views

Downloading a page in Android

I tried to create a class which downloads the html source from a link and saves it. I'm a newbie to all this Android stuff, even new to Java, but this is what I have so far. It seems to work at ...
5
votes
3answers
280 views

Multiple background tasks

This is taken from my post at Stack Overflow here. I need your help to review my code for improvement and best practice. ...
4
votes
2answers
112 views

Generic callback object, but I need the type parameter inside methods

Inside my android app, I currently have methods that look like below code. Since they all need a callback object that basically does the same thing and I would like to try to eliminate the duplicated ...
3
votes
1answer
45 views

First attempt at designing a 'ProfileActivity'

I designed this layout in Balsamiq for my ProfileActivityand I tried to replicate it. The screen on the left fits the correct proportions, whereas the screen on the ...
2
votes
0answers
78 views

Android Gradle script in multi-module project

I've a multi-module Android project build by gradle with the new android-plugin 0.10.+ All modules are mainly configured from the root project. I've enable the new code coverage feature. The major ...
6
votes
1answer
195 views

Is this Android click handler using threads correctly?

I am implementing a thread like the following. Is my implementation correct? It works well, but I need a check. ...
5
votes
1answer
51 views

Simulating Pendulum Motion in Android

Quite sometime back I had written an Android application which simulates the path of a pendulum. You can also have look at the complete discussion in my technical blog here. Please review it and ...
1
vote
1answer
92 views

Implementation of Finite State machine in long running task in an Android service

In the below example I have tried to show how we can break a long running background task running in a service into different states of a state machine and notify the front end UI about each and every ...
3
votes
1answer
44 views

Tile map movement by touch

I am currently developing a game for Android. One of the things I am working on is moving the map by touch. This is the code that handles getting speed, which is then added to the screens position ...
10
votes
2answers
135 views

Image handling class

Let me start by saying that I am very happy with this code. I want to share it with other people because I think they will find it helpful, but I want to make sure I did everything in good form ...
2
votes
3answers
98 views

Best practice creating model? [closed]

Version 1 ...
6
votes
2answers
91 views
4
votes
2answers
312 views

Communicating with other fragments or to activity

Android documentation says: Often you will want one Fragment to communicate with another, for example to change the content based on a user event. All Fragment-to-Fragment communication is done ...
3
votes
1answer
160 views

Holding a reference of the active Android Activity

I recently had to work in a tricky piece of work for a project I am working on. You can find its code on GitHub and I'd like to have a feedback about some specific parts of it. The project is a ...
5
votes
2answers
276 views

Decrease Image downloading time with HttpURLConnection

This is piece of code is using to download images. Can somebody tell me how to optimize this code to decrease download time for each image? ...
6
votes
2answers
313 views

Simple application for finding local restaurants

I was asked to create a test APK file by a company HR when I applied for an Android developers job, Specification: The goal is to develop a simple application which finds the local restaurants. ...
7
votes
4answers
483 views

Sound manager for Android

I created a singleton class for managing sound effects on Android. This class will only be instanced and loaded once at the beginning, and each activity will use the loaded songs. I don't know either ...
6
votes
1answer
90 views

Animated ScrollView

I have this code which runs when an Async HTTP call is made on a HorizontalScrollView ...
2
votes
2answers
615 views

Gridview shuttering when scrolling

I have more than 1000 items in my GridView. When scrolling though, it appears to make the app 'shutter'. Each time I load images from Picasso GC, it increases. ...