I’ve got a bug involving httprequest, which happens sometimes, so I’d like to log HttpGet and HttpPost request’s content when that happens. So, let’s say, I create HttpGet like this: This is the string representation that I’d like to get: With the post request, I’d also lik…
Tag: android
Change NameValuePair separator from ‘=’ to ‘:’
I am trying to send a HttpPost request, and to do this, from what I understand, you do this: The problem I’m having is that the entity looks like this: But due to the way the server is set up, I need it to look like this: You will notice that rather than equal (=) signs, there are colons (:)
Run Handler messages in a background thread
I want to run some Runnable in a background thread. I want to use Handler because it’s convenient for delays. What I mean is Where runnable should be run in background Thread. Is it possible to create such Handler? Is there a “background” Looper somewhere or how can I create it? P.S. I know …
Connection refused on remote IP, but accepted on local IP
As the title says, I have my server running on a local machine, I tested and debugged it and it worked perfectly (server is written in java as well). But when I tried to test it with my remote IP (instead of 192.168.0.113 I used 146.255.x.x), and the server didn’t receive anything, while the client has …
How to get the weekday of a Date?
I want to get the day of week from the Java Date object when I have an array of Date in String with me. Does anyone know the answer to this? Answer You can get the day-integer like that: If you need the output to be “Tue” rather than 3, instead of going through a calendar, just reformat the string…
Android Thread Allocation – growing heap?
Hi everyone out there, i am developing an android application against API 7 at the moment in which i use an activity which need to be restarted. Lets say my activity looks like this: The problem is that the gc doesnt seem to free the fullAnim thread so that the heap is growing by ~100K at every restart –…
Change the System Brightness Programmatically
I want to change the system brightness programmatically. For that purpose I am using this code: because I heard that max value is 255. but it does nothing. Please suggest any thing that can change the brightness. Thanks Answer You can use following: In your onCreate write: Write the code to monitor the change…
How to make EditText not focused when creating Activity
I’ve read the other questions discussing this, and all of them work for my layouts, except for the very first one created. At the moment, this is at the top of my onCreate method: ^ That makes it so at least the keyboard doesn’t pop up on startup, but the EditText is still focused on. This is the …
Android: Image upload to web-service loses EXIF data
Please help, I currently upload an image to my web-service which does have the EXIF data attached to it at time of upload. When it arrives on the server, it is minus it’s exif data. Before I upload the image, it’s stored to the devices SD card to which is then decoded using the BitmapFactory class…
In Activity.onCreate(), why does Intent.getExtras() sometimes return null?
This was probably a false alarm, see my own answer. Original question below: An activity has a button that takes the user to another activity. To launch the new activity, we populate our Intent with extras, and onCreate(), the new activity reads from those extras via Intent.getExtras(). We assumed the returne…