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

learn more… | top users | synonyms

3
votes
1answer
15 views

Creating a fast Android dictionary (word counts)

This is a follow-up of my question here: I am currently working on an application for various statistics. One task is to analyse a good amount of sentences for their word counts. The specifications ...
5
votes
1answer
114 views

Using temporary variables or calling a method directly

Which of these approaches for a button click is better/faster/more efficient, and why? Approach One: ...
3
votes
2answers
79 views

onSaveInstanceState() - ensuring a call to super instance

When onSaveInstanceState() is customized it should always call the same method on the super instance first. I usually write: ...
4
votes
2answers
43 views

Fetch details from server

I am using this code to fetch some details from server from my android app. How can I improve it? Here I am also transferring some data from one activity to another. This is how I have written my ...
6
votes
2answers
49 views
10
votes
4answers
485 views

Integer seconds to formated string mm:ss

I have a String like "Time left (XX)" or "You need stay here for (XX)" and int as second. I use those two variables to format ...
4
votes
2answers
167 views

Calculating months elapsed since a given date

I am using traceview and DDMS to analyse my operation. The following is my traceview as displayed in DDMS: According to the above, the LoaderClass.months() ...
0
votes
1answer
42 views

256 bit AES encryption in Android

I am using the following code to encrypt a file in an SD card in Android: I want the code to be reviewed for: Security (prioritize this) Coding Style Performance ...
2
votes
1answer
33 views

Android loading playlists function

...
3
votes
2answers
82 views

Is this too much work for 1 listener?

Is this too much work for 1 touch listener? Is this bad for devices with slow CPU's? ...
2
votes
1answer
60 views

Refactoring Android fragments

I have an Android app that shows some fragments, but I'm repeating lots of code. MainActivity.java ...
2
votes
1answer
50 views

Loader animation using Custom View in Android

I created a loader animation for an Android app: a simple 3 dots loader. Is this the correct way to animate by using TimerTask? ...
0
votes
0answers
7 views

Rounding to one decimal place [migrated]

I im currently working on a temprature converter app. Everything works but I can get over 5 decimals and I have tried to look it up and search on Google but can't find out how do it. Here is where I ...
7
votes
1answer
92 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
127 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
82 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
182 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
745 views

Class for catching error and logging

I often write something like this in my code: ...
5
votes
1answer
43 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
107 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
385 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
239 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
56 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
58 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
32 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
50 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
69 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
47 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
76 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
78 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
2answers
212 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
163 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
62 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
44 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
292 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
38 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
60 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
111 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
62 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
89 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
85 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 ...
4
votes
1answer
81 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
58 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
95 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
288 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
125 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 ...
4
votes
1answer
56 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
96 views

Android Gradle script in multi-module project

I have a multi-module Android project built 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
212 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. ...