Questions tagged [android]

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

Filter by
Sorted by
Tagged with
2
votes
1answer
3k views

Android Bluetooth device application

I am writing my first Android application and have mainly been using code examples online. However, I have been going hard at it for a while now and realize that I have some overlapping methods and ...
2
votes
1answer
130 views

Nice way to using cast on TextView [closed]

Question is short. Assuming that I don't need reference itself, would this cast ((TextView) findViewById(R.id.someTextView)).setText("lala"); be better (or at ...
1
vote
1answer
1k views

Getting user's current location

I am trying to get user's current location base on the accuracy and less battery consumption. Please review my code to help determine if I am going in right direction. ...
1
vote
2answers
4k views

I am trying to manually serialize an android.Bundle. Any thoughts on the implementation?

I wrote this because I need to store an unknown bundle to a database. Most everyone suggested to Parcel it. The problem is the android docs specifically say not ...
3
votes
2answers
995 views

BigDecimal code critique

I'm teaching myself BigDecimal and would appreciate a critique. In the code fragment below, I calculate a tip from user input: check and tip percentage (entered as integer): ...
3
votes
2answers
8k views

Optimizing mass inserts into SQLite

I am trying to optimize inserts from a returned JSON which contains data from multiple tables on the remote server. My code is working, but I just want to figure out a way for it to work better. I ...
2
votes
3answers
7k views

Small Android AsyncTask project

I created a small Android project with an AsyncTask. It simulates a time consuming task. Please review my code and tell me what you would do on a different way and why. Comments not specific to ...
2
votes
1answer
5k views

Efficient implemetation of AlertDialog callback in Android

One day I realised that my Android project utilizes AlertDialogs here and there in very ineffective way. The heavily duplicated portion of code looked like this (actually, copied and pasted from some ...
3
votes
2answers
7k views

HttpClient error handling

I would be happy to hear feedback on my implementation of HttpClient. I am not so strong with error handling so I want to improve. My thought process behind this was that ...
2
votes
1answer
3k views

Fast image binarization on Android

I'm working on an application that turns a raw camera image into a binary (pure black/white) image and I need this to happen as fast as possible for swift further processing. This is what my code ...
8
votes
4answers
3k views

Poker game classes

I've built this two classes for a Poker game on Android and I would appreciate some feedback on my code. Have no mercy. The harsher you are, the better. Feel free to add your number of WTFs/minute. ...
3
votes
1answer
4k views

AsyncTask, Android, and SQL

I originally posted this in stackoverflow.com but the question may be too broad. I'm trying to figure out the best way to download and use an SQL database from my server. I have included the code i ...
7
votes
5answers
2k views

Anonymous Classes for Listeners

While working with Android GUI my approach to adding Listeners for GUI elements is usually: ...
2
votes
1answer
356 views

Android SwitchedService class design, for cases where you want to start/stop a service from BroadcastReceiver

I could use some feedback on the class I designed for the above purpose, the complete code is here: https://github.com/tom-dignan/android-switched-service/blob/master/src/com/tomdignan/android/libs/...
8
votes
1answer
27k views

Optimize JSON insertion to SQLite (insert … on duplicate key ignore)

In current task, I'm refactoring the code of converting JSON file into SQLite database on Android device. Code compliant with Java 6. As a benchmark, grabbing the code from remote server takes ...
3
votes
1answer
160 views

Allowing simplified browsing of websites with a predictable URL structure

The code below has been a pet project of mine for some time. It allows simplified browsing of websites that have a predictable URL structure, namely TGP websites. It has been greatly modified from ...
3
votes
1answer
196 views

Static variable Current in Application

I was finding myself frequently calling getApplication() and casting it as MyApplication so that I could call a method in ...
24
votes
3answers
26k views

Reusing StringBuilder or creating a new one? [closed]

Given that it is better to reuse objects than create new ones when developing with Android, is it worth while deleting the contents of a StringBuilder and reusing ...
3
votes
2answers
3k views

Extracting Android contact Info

I am new to Android programming and I'm working on an Activity in an app that will plot the location of contacts from a specific email account on to a map. The following is what I in a class that the ...
8
votes
2answers
32k views

Secure AES encryption and decryption in Android [closed]

Is this implementation of AES for Android safe? Is it 128 bit encryption? How can I strengthen this implementation? Please help me, all suggestions are welcome :) ...
6
votes
1answer
469 views

Database interaction logic

I have a database-intensive app, almost every activity requires access to the database, both reading and writing. I had a lot of problems with separate threads and activities on the stack closing ...
3
votes
5answers
2k views

Three edittext boxes: suggestions to clean up code

I am a newbie at writing Android apps and using Java in general. I have went through most of the Android hello view tutorials but still seem to be lacking some understanding of the basics. Here is a ...
2
votes
2answers
2k views

How to make a int not be used twice when it randomly generates them? [closed]

I've coded a simple quiz game for Android, and currently Im having troubles with making questions not appear after they've been shown, i.o. I dont want it to ask me the same question twice.. This is ...
7
votes
1answer
241 views

Random Q&A system

Basically, I made a simple app for my Android, where it picks a random question for you, and picks specific answers. Only 1 of the answers is correct, while other's aren't. Also, after editing the <...
4
votes
1answer
808 views

AsynTask example

As I was trying to demystify the Android AsyncTask functionalities, I wrote this sample app to test it. Please review my code and suggest possible improvements: ...
6
votes
3answers
1k views

Is using java enums to store filepaths good practice

I'm working on an android application, but this is basically plain 'ole java. The aim is to do the right thing and not repeat myself. ...
6
votes
2answers
1k views

Template for creating 2D games

I am using the following template to program my 2D games in. Is there any way I can improve it? Splash screen: ...
13
votes
5answers
16k views

Remove useless whitespace from styled string

I have a big string resource (basically the "about" text of the application) which contains styles (such as <b>, <a> ...
8
votes
2answers
1k views

Adding a Fish Eye Distortion to a Bitmap

I have the following class that processes a Bitmap to place a fisheye distortion on it. I've run my app through TraceView and found that virtually all the processing time is spent looping through the ...
4
votes
1answer
5k views

EPUB reader for Android

How do I improve this code for reading an epub file? The code is as follow: ...
4
votes
1answer
6k views

Unit Converter App

Please review this Android UnitConverter App which has been designed using Strategy Pattern. ...
-1
votes
1answer
187 views

Specify table data in code, reference objects

...
39
votes
7answers
3k views

Is my code a 'safe' singleton?

I was wondering if my code will produce a true singleton. I am creating an Android app, and all activities should access my API through one instance of the SyncApi ...
32
votes
2answers
32k views

Custom CursorAdapter Design

Here's the code which I use for my Android custom cursor adapter which I use to bind data to my list view. ...
7
votes
2answers
2k views

How to increase download speed using the following method?

I have written an Android application which downloads pdf files through web service. I am using kSoap2 android library to parse the response of web service which basically contains file name & ...
2
votes
2answers
224 views

Function to turn to requested bearing

I've been writing a function: float turnToRequestedHeading(float initialHeading, float requiredHeading, float turnRate) I keep thinking there must be a clever ...
11
votes
3answers
19k views

Simplified Android Spinner

I have written a simple spinner wrapper, but was wondering if any of you could think of any ways to make it more robust. It only handles strings at the moment. ...
6
votes
1answer
810 views

Android ListAdapter design advice

I want to write an Android ListAdapter to serve data from a database that look like this: ...