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
43 views

Building 30 day alarm

I'm building an alarm set to reoccur every 30 days - I was wondering if I could get a few extra sets of eyes to look things over and see if you can notice anything I may have done wrong. Any/all ...
0
votes
1answer
65 views

Review my PuzzlesView android component

Began to read the book "Clean Code" by Robert Martin, I had a strong desire to learn how to write code that easy to understand other people. Please criticize my code. PuzzlesView.java // Using of ...
0
votes
0answers
18 views

android app crashes onclick [closed]

I am new android dev. I am creating my first app. I am debugging on eclipse and actual android phone. app loads fine but crashes when click the "outputBMI" button when i click this button eclipse ...
2
votes
1answer
56 views

JSON AsyncTask refactoring to improve quality?

I'm new to Android. I was wondering if anyone had any suggestions. It's basically an AsyncTask to get a remote JSON array and put it into a native array. Would be very grateful for suggestions. ...
1
vote
1answer
81 views

Write and read non-serializable object to file android example

I couldn't find a good example, so after some fighting with writing non-serializable object to file in Android, I decided to show you my solution. Could you tell me if it is OK or how could it be ...
1
vote
2answers
74 views

how to refactor this java [Android] code

I have this code to generate some tables in my PDF document for my android app. It works fine, I just think I need to refactor it, as basically is the same structure repeated 3 times. //tables! ...
0
votes
0answers
41 views

Orginization of Code

So I'm writing an app for android and I'm trying to figure out how to write it more efficiently. If I was writing it in Java, I would have had seperated the code into methods and classes but I'm so ...
2
votes
3answers
153 views

Please help me clean up a lot of if else statements

Hello guys I'm new to Java programming. I'd like anyone here to help me clean up my code. It's about calculating men's risk of getting coronary heart disease. Here's the link to my method: ...
1
vote
1answer
75 views

How can I make jquery animations faster for mobile devices?

I recently made this campus timeline for my university. You can see it here My question is this: When viewing the timeline on a mobile device (not a tablet), the navbar changes so that you can jump ...
0
votes
0answers
102 views

Dual Analog Stick Controls

I started this question to get people to grasp a little bit more on how it is to develop analog controls for android devices. But my code is a little outdated so if anyone knows how to implement it ...
0
votes
0answers
84 views

Optimization of Android code suggestions? Iteration based

At the "if(a==2)" part of my code below, the android emulator takes 8 seconds to process and display some data in a list. I need to reduce this time to 1 second or less. I am accessing a 50 KB .txt ...
0
votes
0answers
87 views

Android database access

For my simple Android application I don't want to use an ORM, anyway I'd like to have a db-communcation layer easy to user, to read and efficient. This is my solution: every entity (ex: Person) as an ...
3
votes
1answer
214 views

Java thread safety and caching techniques

This is my first Java multi-threading code. It is part of an Android application that is a client to a webpage that serves books. Each page of the book is in a separate PDF, and the Book class ...
3
votes
2answers
59 views

Is my logic correct checking for a newer remote file?

String slm = status.getHeader("last-modified"); SimpleDateFormat sdf = new SimpleDateFormat( "EEE, dd MMM yyy HH:mm:ss zzz"); Date serverLastMod = null; try { ...
5
votes
1answer
138 views

Get rid of pokemon exception handling

I wrote a productivity app for Android. It let's you switch system settings, like bluetooth, wifi, screen brightness, volumes, ringtones, mobile data, airplane mode, etc. Unfortunately I have ...
0
votes
0answers
37 views

Android Homescreen Widget Service… Efficient or a Mess?!

I have implemented changes from a question I asked on this widget here: Android Widget Code Review I've added and changed a few things, so would love some more coding advice! Ever learning, but ...
1
vote
0answers
45 views

suggestion to improve http get and post code

Hi all I had developed an application in which I hit several urls and show data on mobile. But problem is that it requires more time. If I check same url on Firebug tool I got response in 2-3 seconds, ...
2
votes
0answers
62 views

Is this a correct way to handle a thread which uses a socket?

I am building an app for android to control VLC (mediaplayer) that runs on my computer. Atm it's just a prototype and it works but I was wondering if I am correctly managing my HandlerThread and ...
1
vote
0answers
27 views

Is this code optimal? Image-downloader/wallpaper setter

I'm making an image-downloading app that sets the image as the device wallpaper. For this I used the class: ImageDownloader.java This class has a function which accepts a url and an ImageView. It ...
0
votes
0answers
90 views

Please criticize my mini-app for android

Began to read the book "Clean Code" by Robert Martin, I had a strong desire to learn how to write clear, easy to understand other people code. ColorViewer application allows you to view the color in ...
2
votes
2answers
84 views

Android Widget Code Review

Anyone have any comments? Just trying to better my code if can be done. Thanks. public class SacWidget extends AppWidgetProvider { String roseUrl; AQuery aq; public void onUpdate(Context ...
1
vote
2answers
56 views

Setting a OnClickListener in a loop

I am trying to set a OnClickListener to a image in a loop. If the params platform is "android" then use market app, instead of default browswer. Is there a better solution to my exception handling or ...
0
votes
0answers
46 views

I would like to ask for suggestions, criticisms and/or possible edits on my class file to be used on an Android Applciation?

I have a class file that would be used to connect and execute queries into the database. The only thing I am confused about is this: do you really need to drop tables and re-create them everytime you ...
3
votes
0answers
40 views

Safely accepting a known SSL certificate with a different host name Android

My app communicates with a server over an internal network through https. The SSL certificate on this server is listed for the host as its external host name. I want to accept this certificate, but I ...
4
votes
0answers
55 views

I want to create circle with words android

I have created circle with words but it work to slow. Here code of drawing this circle: private final float STEP = 180f / 31f; public final int TEXTVIEW_COUNT = 62; private final float PI = (float) ...
2
votes
1answer
119 views

Sorting parallel ArrayList

I have a model class that contains 3 ArrayList which are in order by parallel of the same size. <Object><Calendar><Long> I want to sort it by the <Long> Is this the most clean? ...
1
vote
5answers
105 views

Write this more efficiently?

I have the following code: Integer cr = 3; String y = "\"\r\n\""; for (Integer i = 0; i < cr; i++) { for (Integer j = 0; j < cr; j++) { for (Integer ...
1
vote
1answer
280 views

Crossword game - designing class structure

I've planning to create crosswords game for Android platform. Basically, crossword is a matrix of TextFields (EditTexts) and TextViews. Each crossword might be in american style (first TextView in ...
-1
votes
1answer
71 views

Applying for a job as a Java developer/QA Specialist [closed]

I have recently applied for a job as a Android Java developer/QA specialist. The company has now asked me to show them some of the code that I have written so far. Since I am a indie developer, that ...
0
votes
1answer
116 views

Force Stop by Error in httpClient.execute(httpPost);

It work's at Smartphone(Android 2.3.3) but Tablet(Android 4.0) => Force Close!! public String getXmlFromUrl(String url) { String xml = null; try { // defaultHttpClient ...
1
vote
1answer
71 views

Using java keyword final on reference objects inside methods body [closed]

As per Joshua Bloch's book "Effective Java", Item 15 - Minimize mutability, using final keyword on private class fields in addition to immutability and thread-safe syncing could improve performance. ...
1
vote
1answer
217 views

Why is android.app.Application not singleton by default [closed]

In many Android applications which I have found online or written myself, there is an application class like this: public class MyApp extends Application { private static MyApp instance; ...
3
votes
2answers
173 views

Change View visibility programmatically or through XML?

I have an XML layout used by 2 activities. Within this layout, there's a view that is visible for Activity1 and gone for Activity2. Activity1 is used more times compared to Activity2. I would like to ...
1
vote
1answer
401 views

Persistent Cookie Store

So my app needed a cookie store that persists over the app closing, device reboot etc. I decided to use the sharedPreferences for this. The class works pretty well, in both my tests and on the device. ...
3
votes
0answers
88 views

OpenCV Mat processing time

I'd like to know whether having different variables for the src (source) and dst (destination) of an OpenCV function will have an effect on the processing time. I have two functions below that does ...
0
votes
1answer
54 views

Compare Arrays in Dice game [closed]

I found an open source project that has a few bugs (I have fixed a couple so far) but this one has me stumped. The issue that I am trying to solve... If I have 3 sets of pairs (isThreePair) and it ...
1
vote
2answers
149 views

Reading a Bitmap from disk on a separate thread on Android

I want to defer the reading of a bitmap to another thread. I'm mainly concerned about concurrency issues since I'm kind of green on that subject, so I would like to know if this code has any potential ...
3
votes
1answer
82 views

File to String Pattern for uploading to a server

I need to upload some images to a server. This is done with a json object. The json object has 2 values, a timestamp and a Base64 encoded string of the image. I am using the jackson library and was ...
3
votes
1answer
165 views

Is this the best approch to combine 2 Interfaces?

I have a use case where I want to use both HttpRequestInterceptor and HttpResponseInterceptor in one class. I'm asking if the following would be a good solution and what are the potential problems? ...
1
vote
1answer
223 views

An XML stats page for my game

So I am making a stats page for my android game, and I have never really used the android xml layout stuff, so I'm sure things are a little messy and strange. The layout ends up looking pretty good, ...
4
votes
1answer
277 views

Android findViewById in separate class

I'm new to Android and I wanted to create a class that would load an ad inside the current layout. All the layouts have a RelativeLayout id=adLayout From my main, I have: AdLoader al = new ...
0
votes
0answers
187 views

spectral Subtraction in java

hello all this is my Java Code for Boll's 1979 Spectral Subtraction Algorithm in Java . this is based on Esfandiar Zavarehei Matlab code. i have added some samples. the code works very good and i'm ...
1
vote
1answer
270 views

Bash script for reverse engineering Android applications

I'm new to bash scripting and need some help improve a script I made for working with reverse engineering Android applications. I wrote comments in the script itself to explain what I want to do. ...
0
votes
0answers
288 views

How can I simplify this Android program?

I just started learning Java/Android programming. This is my first basic program and it is working fine now. Thanks to the Stack overflow folks for helping me out. Now it would be really helpful if ...
2
votes
1answer
67 views

What about percentage usage?

So, i'm thinking about the usage of percent, example, in margins. We can use overlay to separate our layout by dpi sizes, but why can't we use percentage? Something like that: Display display = ...
2
votes
2answers
75 views

Pending Method Invocation

I need to do pending methods invocation in Java (Android) in my game project. A method represents actions in a scene. May be you're familiar with Context.startActivity in Android which is not suddenly ...
0
votes
1answer
133 views

What does synchronized mean? [closed]

I am new to Android, and am converting a file I found, but ran into something I don't recognize. Can anyone tell me what this means? public void write( byte[] out ) { ConnectedThread r; ...
3
votes
2answers
207 views

Download Progress Calculator

Here is my progress calculator class. It is used for downloads/uploads. It takes bytes in and calculates the percentage(to the nearest 5%) that should show on a progress bar. Please let me know how I ...
3
votes
1answer
2k views

Basic android calculator

So this is my code and I would like to add subtraction, multiplication and division. If you have any suggestions on algorithms to use I would be very happy to see it. I do not wish to copy the code, I ...
0
votes
1answer
184 views

What exactly is this code doing? [closed]

I am making an Android Application which connects my android device to an embedded bluetooth chip. I have looked a lot online and in textbooks and have found several methods to send/receive data. I ...

1 2