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

learn more… | top users | synonyms

1
vote
1answer
60 views

Builder for a simple observer class

I mean the Builder presented in Effective Java by Joshua Bloch. OnStopScrollingObserverTask is using to detect when scrolling a ...
2
votes
0answers
31 views

Performing a background task and managing battery notifications for Android

I'm just starting out for the first time in Android Development and my code is a giant mess. Here are my attempts so far. I've included it in a Pastebin. Feel free to ask me if you would like to see ...
1
vote
0answers
25 views
5
votes
2answers
49 views

Helper class to send emails with attachments on Android

I use this EmailTools helper class inside an Android app to send data as an email attachment, by calling ...
-5
votes
0answers
53 views

Java very slow execution of A* Pathfinding Algorithm [closed]

I am creating a Maze game in java and wants to add a smarty ghost (like Pacman) that move towards user location to catch him. For smarty ghost I chose A* PathFinding Algorithm and found below links ...
6
votes
2answers
54 views

Performance of speech enhancement code for Android app

I wrote a speech enhancement code for an Android App. The algorithm runs on 256 size frames of voice samples. On my PC the code runs per about 5ms per frame, while on my Nexsus 5 it more like 50ms per ...
17
votes
2answers
2k views

Android Flashlight app

This is my first project, a Flashlight application for Android-based devices: ...
7
votes
1answer
134 views

Fully-working alternative to String.format(…)

PLEASE NOTE: The code below has "commented out" code; however, no code is actually commented out!! Check my GitHub link below. I did that solely to highlight the relevant code sections. Code in my ...
1
vote
1answer
27 views

Grouping utility methods for View classes

I have the following class: ...
11
votes
1answer
162 views

Small android app that gives a movie based on the chosen genre

Working on my first "big" project using the mighty Xamarin. Likewise my first venture in XAML so I suppose most focus will be going towards these new areas. Performance- and user-experience related ...
3
votes
1answer
63 views

TaggedLogger - Log wrapper

I wrote this class in order to not having to write tag every time (because of code duplication and risk of typos). ...
5
votes
2answers
114 views

Persistent cookie support using Volley and HttpUrlConnection

I need to add support for persistent cookies on an Android app that I'm building for Authentication/Authorization. This app uses Volley for making HTTP requests and it's ...
6
votes
1answer
66 views

Handling large images efficiently (to avoid OutOfMemoryError)

After lots of attempts thanks to all the Android enthusiasts, I've found a method to handle large images efficiently in Android Applications in order to get rid of ...
4
votes
2answers
134 views

ToastUtils - helper class for Android SDK Toast

Using: ToastUtils.LONG.show(context, R.string.greeting); Code: ...
7
votes
1answer
85 views

Android “Search” Activity and corresponding XML

Below is an Android Activity and corresponding XML layout. The function of the class is to search an ...
3
votes
1answer
59 views

Structural design of a Date and Time classes [closed]

I have two classes named Date.class and an enum class Time. I have declared these class like ...
6
votes
2answers
59 views

Android audio player

I want to implement basic audio functions like play, stop and pause. I have stuffed all the code inside onCreate method. Is this best practise to follow? ...
7
votes
2answers
139 views

Using Java to Add the Contents of two EditText views in Android

I have a toy app that contains: editText1 for entering a number. Uses inputType of number. ...
3
votes
1answer
50 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
121 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
91 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
53 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
55 views
10
votes
4answers
501 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 ...
5
votes
2answers
194 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
78 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
43 views

Android loading playlists function

...
3
votes
2answers
90 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
80 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
81 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? ...
7
votes
1answer
102 views

Perfect game loop

I've been working on development for an Android game, and this is the game loop I have so far: ...
10
votes
1answer
183 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
117 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
185 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
753 views

Class for catching error and logging

I often write something like this in my code: ...
6
votes
1answer
52 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
374 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
389 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
360 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
79 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
64 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
33 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
65 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
81 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
53 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
77 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
86 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
574 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
175 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 ...