BlackBerry class equivalent to AsyncTask?

My requirement is to have a thread that maintains a socket connection between a BlackBerry device and a server and exchanges commands, similar to request and response. My problem is that I need to have this thread running in the background all the time and keep the UI available to the user. So, when there […]

Android, the standalone version of traceview is deprecated

I want to see my traces. 1- In code, I have added these lines of code: // Start trace recording android.os.Debug.startMethodTracing(“hc_traceview”); and // Stop trace recording android.os.Debug.stopMethodTracing(); 2- I can see “hc_traceview.terac” in file explorer of DDMS. 3- Based on Viewing Trace Files in Traceview, I ran following command in terminal: @hesam-K5VD:~/Desktop/Eclipse/sdk/tools$ traceview /mnt/sdcard/hc_traceview But […]

Android: bitmapfactory.decodestream returns null

I have tried to get the bitmap image from the path of the image. But BitmapFactory.decodeStream returns null value. Code: URL url = new URL(path); HttpURLConnection connection = (HttpURLConnection) url.openConnection(); connection.setDoInput(true); connection.connect(); InputStream input = connection.getInputStream(); Bitmap myBitmap = BitmapFactory.decodeStream(input); connection.disconnect(); input.close(); I have searched in more sites, still i did not get the solution.

android converting XML View to Bitmap without showing it

i’m trying to set a view to my map cluster. i’m inflating a view from an XML and setting the Text according to cluster size and i want to show that view. in the following code i get a null bitmap in return: private Bitmap createClusterBitmap(int clusterSize) { View cluster = LayoutInflater.from(context).inflate(R.layout.map_cluster, null); cluster.setText(String.valueOf(clusterSize)); cluster.setDrawingCacheEnabled(true); […]

How to read android sim contacts and phone contacts separately

I want to read all sim contacts and phone contacts separately in Android. I searched for this and found lots of people having problem with this and I couldn’t find any solution yet. I fond some answer here, but it doesn’t work for me. When I test this it give me google contacts: RawContacts.ACCOUNT_TYPE + […]

org.json.JSONException: Value <!DOCTYPE of type java.lang.String cannot be converted to JSONObject

Here I want to display the JSON content using API key. But I am unable to get the authentication. I am getting the error in JsonObject: org.json.JSONException: Value Authorization of type java.lang.String cannot be converted to JSONObject In my android application, I just pass the API key and URL id to get the JSON response […]

How can i make a dynamic flipping screen(like that of iPhone) in Android

I am parsing data through the web service. I want the flipping horizontally rather than vertically. Here is a tutorial where ViewFlipper is used but it is for static data. Here is our code where we need flipping between 2 activities: Splash.java public class Splash extends Activity{ /** Called when the activity is first created. […]

Android Layout Weight not working with relative layout

Hey Guys Myself Trying to implement layout weight for the first time,a bit i tried with linear layout it works good,but when i tried with relative and linear layout something went wrong.Could you guys suggest me what is wrong here My XML File <?xml version=”1.0″ encoding=”utf-8″?> <LinearLayout xmlns:android=”http://schemas.android.com/apk/res/android” android:id=”@+id/Linearlayout” android:layout_width=”fill_parent” android:layout_height=”fill_parent” android:orientation=”vertical” android:weightSum=”100″ > <RelativeLayout […]

Custom Progress Bar in Android?

I havent got a clue to how to do this. My progress bar should be the shape of cloud. Can someone direct me to a book, tutorial or just give the right step by step method? Thank you for your time.

The import com.google.android.gms.location.LocationClient cannot be resolved after formatting computer

I formatted my computer and again imported my android project which has been done using Google Maps API V2 and found out many errors.I re-linked google_play_services_lib and android-support-v7-appcompat.I still find an error in importing com.google.android.gms.location.LocationClient.Only the call of “LocationClient” gives an error and others are imported fine. import com.google.android.gms.common.ConnectionResult; import com.google.android.gms.common.GooglePlayServicesClient; (ERROR)import com.google.android.gms.location.LocationClient; import com.google.android.gms.location.LocationListener; […]

Android Babe is a Google Android Fan, All about Android Phones, Android Wear, Android Dev and Android Games Apps and so on.