Android is Google's software stack for mobile devices. Please use the Android-specific tags such as [android-intent], not [intent]. For non-developer questions, see http://android.stackexchange.com

learn more… | top users | synonyms

0
votes
0answers
14 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
192 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? ...
2
votes
1answer
112 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
248 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
68 views

Animated ScrollView

I have this code which runs when an Async HTTP call is made on a HorizontalScrollView ...
2
votes
1answer
163 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. ...
2
votes
0answers
65 views

Latency problem for keyboard remoting from Android phone - follow on [closed]

This is a follow on question to these previous questions: Both TCP and UDP implementations Modified TCP-only solution I'm writing a simple remote PC app (mouse-keyboard). Android is the client and ...
7
votes
1answer
60 views

Android close running apps

I have developed a service to automatically detect whether an app has started. If the user forbid this app to start (could be chosen from a list of apps), a dialog will be shown. ...
5
votes
2answers
206 views

Using an AsyncTask to populate a ListView in a Fragment From a SQLite table

This is the first time that I have played around with AsyncTask in Android and I wanted to make sure I'm using it correctly. The idea is I'm grabbing all the rows from a table in the database using ...
2
votes
1answer
40 views

Appropriate way to create object for storing data in a ListView & Profiling

I'm creating a location based reminder application in Android using proximity alerts, geocoder, Google Maps API and their Places API. Currently there is a default ...
5
votes
3answers
112 views

Latency problem for keyboard remoting from Android phone - follow up

I'm writing a simple remote PC app (mouse-keyboard). Android is the client and is connected with WiFi to Java PC Server. I'm using TCP but I see a bit of latency compared to other remote apps. I'm ...
7
votes
1answer
105 views

Latency problem for keyboard remoting from Android phone

I'm writing a simple remote PC app (mouse-keyboard). Android is client and is connect with WiFi to Java PC Server. I'm using TCP but I see a bit of latency compared to other remote apps. Then I used ...
6
votes
2answers
105 views

Android Thread and Runnable

This is my code for running a background thread. I believe it is very poor in naming and code structure. ...
6
votes
1answer
68 views

Dividing the screen in two halves using LinearLayout

I want to divide the screen in two halves. The layout is locked on portrait mode. The top half will have one button and the bottom half will have many buttons. That's why I choose this division, since ...
7
votes
4answers
198 views

User search implementation

In my Java code I have these three classes. Basically I have a User class, and also a GUI class that holds TextViews and other things (GUI related) for the ...
2
votes
2answers
74 views

how can I factor out REST-POST activity to a manager?

I have this RestPostActivity: ...
0
votes
1answer
72 views

Parcelable City [closed]

I am new to the Parcelable interface that I have implemented in my classes. At first they were Serializable, but now I have ...
4
votes
1answer
120 views

How can I reduce the number of nested if statements in this code?

The application I'm building can accept two types of updates: Application Update and Parameter Updates. If there is an application update, then parameter updates can be ignored. This is the code that ...
1
vote
2answers
63 views

Setting image margins and location based on orientation

This code is for Android but I guess anyone can take a chance at it. It does what I want it to do. Just that I am not comfortable with its deep level of nesting and too much of value swapping. Can ...
2
votes
2answers
80 views

How to name this very simple class?

I want to give a short and clear name to this class: ...
2
votes
2answers
432 views

Android AsyncTask, HTTP Request and Parsing

I am working on Android applications for last 2 years and about 80% applications I have developed involve web-services consumption followed by some sort of XML or JSON parsing. Initially, when I had ...
4
votes
1answer
80 views

Radio ListView onCheckedChangeListener?

This is my adapter class, to create a custom listView with three radiobuttons: ...
4
votes
1answer
66 views

Simple helper method for JUnit3 tests

In JUnit 3, I cannot tell JUnit what type of exception is expected. In JUnit 4, the ...
5
votes
1answer
121 views

Calculator Android App

I was looking for a review on my coding. Since I'm planning to get a job as a Android Programmer in the long run. This is my first calculator app, which I did by self learning Programming. I have no ...
4
votes
2answers
75 views

Calculating luma of a rect in an image of .yuv format

I'm trying to get the average luma of an area in an YUV image in the Android camera. I have come up with the following code which I think is correct and produces consistent results. ...
3
votes
1answer
73 views

Using Callback in Codenameone native code using Java [closed]

I would like to use Callbacks in my StateMachine to fetch values from Callback class, that is set in the native Android code. Is this a right approach to create one? Do you see any issues with the ...
3
votes
1answer
69 views

How to reduce this RadioGroup Code?

I have 18 RadioGroup. I am declaring the RadioGroup like this way ...
3
votes
1answer
49 views

Proper naming for filter classes

In my Android application, I have two types of filters: search filters and sorting filters. I need to read filters from view, display filter on view, save them into and from memory. I should include ...
2
votes
1answer
61 views

Filter fragments manager

How could I simplify the onCreate() method? Maybe via compact and properly-named methods? ...
4
votes
1answer
70 views

Refactoring RadioGroup setter code?

I am setting different RadioGroup like this: ...
3
votes
1answer
73 views

Any tips on speeding up this sandbox game?

I am working on an app: a virtual sandbox of sorts, a lot like the powder game. The problem is, when working with an app, you must deal with hardware limitations. Don't get me wrong, the speed isn't ...
4
votes
1answer
97 views

Activity using multiple layouts

I have been slowly getting more and more "at home" with Android development and I would like some guidance. I have made an app that uses a ListActivity, that ...
7
votes
1answer
69 views

Clock View in Android

So I have built a clock widget. It basically has 2 hands and displays a time, either the current time or a selected time. There is another option which tells the clock if it should move around as the ...
4
votes
1answer
59 views

Data flow anomaly: how to do it correct?

I am modifying Volley for Android a bit and Findbugs complains about the data flow and I am a bit lost. First the code: ...
8
votes
2answers
219 views

Can this while loop be made cleaner

Moved to Code Review as per comments received on http://stackoverflow.com/questions/20907502/can-this-while-loop-be-made-cleaner Is there a way to make the following while loop a little more ...
0
votes
1answer
72 views

Android export browser history as JSON

I wrote a simple android app to export the browsers history as JSON, but I do not know if the resulting JSON is a format that the user will easily be able to parse and use. Is there any way that i ...
3
votes
1answer
521 views

Simplifying HTML parsing

I'm working on an app for my school (not homework, an app that's going to be used by students), that's supposed to display our week schedules. I get the data from a webapp, but it has no API that I ...
3
votes
1answer
79 views

Android View Controller: Precondition vs ClassCastException

I am working on an Android app that has an Abstract view controller class. I am using that Abstraction and implementing it for an Android Spinner view. It has a method that assigns the view to be ...
4
votes
1answer
74 views

Reducing repetitive Android code

How can I reduce the amount of repetitive code in my Android app? A lot of the code seems to be doing the same thing twice. I think that there is a more compact way to do this. What are some ways ...
3
votes
2answers
57 views

Trouble searching database, filtering results, adding longs (ugly code)

My needs outpace my abilities, this code (mostly) works, but it is really ugly, doesn't always add correctly, and is in desperate need of some help refactoring. I can't wrap my head around what needs ...
6
votes
1answer
175 views

Populate views in Android application

I wrote these classes and I would like to know if this is a correct way. I created a new Project with Blank activity and "Scrollable Tabs + Swipe" as Navigation type. My main activity: ...
0
votes
1answer
64 views

Help me choose a more appropriate name or make this class inherit from another class [closed]

I need to rename the next class or have it inherit from ArrayAdapter<String>. ...
7
votes
1answer
158 views

Home screen widget to display random numbers

I have created a small HomeScreen Widget which displays random numbers. Attached is the code. Please let me know if the approach is good. https://github.com/gottp/HomeWidgetTest MainAppClass.java ...
2
votes
1answer
53 views

Simple object pool on Android

Assume the server is sending data to our app at regular intervals, at least once per second. The received data is parsed and stored in memory as a POJO. A blocking queue is processing data in a worker ...
3
votes
1answer
94 views

How to rewrite my code for adding Buttons to be more time-efficient?

I'm still new to Android development, had a long break due to school and whatnot since I last touched Android. However I did learn a few more things and now I wanted to try making some Text-Adventure ...
3
votes
1answer
188 views

Android sharing selected text to other apps

I am somewhat new to Java. I want to know if this is the proper way to share text with other Android applications, and if I am properly determining if the text is selected. Is there a better way to ...
5
votes
2answers
62 views

Android GameWatch game for learning/review

I am hoping this is the right place. I was hoping to find someone to try and help me not only learn but have a look at what I have already done on Android. DISCLAIMER: I am a long time (10+ years) ...
3
votes
1answer
188 views

AsyncTask for handling server api calls

Got this design for getting rid of checking network availability and informing user of errors. Is it good at all? Please, help. Overall point is to fire server call as short as possible: ...
3
votes
2answers
225 views

Singleton holding and notifying registered listeners

Suppose I am listening for network changes with the following listener: ...
-1
votes
1answer
80 views

How would I improve this class in terms of responsiveness and performance?

I'm about to release this application as a hobby and I'm wondering how would I improve the speed of the calculations and overall responsiveness of the class? I have covered a module briefly in data ...