Tagged Questions
1
vote
2answers
48 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!
...
-1
votes
0answers
38 views
Using getters / setters in android [closed]
I want to find out if my coding structure was less efficient and much slower due to using getters and setters.
I have a few situations where I used them like follows
if(MyClass.getPicCount() >= ...
2
votes
3answers
124 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:
...
0
votes
0answers
66 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 ...
3
votes
1answer
171 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
130 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 ...
1
vote
0answers
39 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
2answers
74 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
53 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
45 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
31 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 ...
3
votes
0answers
45 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
107 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 ...