Tagged Questions
0
votes
0answers
10 views
Write and read non-serializable object to file android example
I couldn't find 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
53 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
40 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
126 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
67 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
185 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
40 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
75 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
32 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
108 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
269 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
68 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
77 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
67 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.
...
3
votes
2answers
161 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
303 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
85 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 ...
1
vote
2answers
140 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
80 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
155 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?
...
0
votes
0answers
180 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 ...
2
votes
1answer
64 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
74 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 ...
3
votes
2answers
202 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 ...