Google Maps v2 Set Zoom Level

When I launch Google maps in Android, it shows the whole world. What do i need to change so as to set the zoom to the marker? Here are the codes. Thanks googlemap.getUiSettings().setZoomControlsEnabled(true); googlemap.getUiSettings().setMyLocationButtonEnabled(true); LatLng cameraLatLng = sfLatLng; float cameraZoom = 17; if(savedInstanceState != null){ mapType = savedInstanceState.getInt(“map_type”, GoogleMap.MAP_TYPE_NORMAL); double savedLat = savedInstanceState.getDouble(“lat”); double savedLng […]

getActivity() where it is defined?

I’m very new to android and I’m following this example. The code says we need to do these steps to get an dialog box: AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); // 2. Chain together various setter methods to set the dialog characteristics builder.setMessage(R.string.dialog_message) .setTitle(R.string.dialog_title); // 3. Get the AlertDialog from create() AlertDialog dialog = builder.create(); But […]

How to disable and enable the scrolling on android ScrollView?

This question already has an answer here: Disable ScrollView Programmatically? 15 answers

Can't find getPackageManager() method in android

I have problem with my project. I can’t find getPackageManager() method although i imported; what wrong with this piece of code List<PackageInfo> packs = getPackageManager().getInstalledPackages(0); .Thanks for your helping

“Cannot override the final method from SherlockActivity”

Am trying to extend my activity with Actionbarsherlock , When i did this i’m getting an error “Cannot override the final method from SherlockActivity” My activity has these imports import; import; import android.os.Bundle; import android.accounts.Account; import android.accounts.AccountManager; import android.accounts.AccountManagerCallback; import android.accounts.AccountManagerFuture; import android.accounts.AuthenticatorException; import android.accounts.OperationCanceledException; import; import android.content.Intent; import android.util.Log; import android.view.Menu; […]

Custom button with drawable background: Padding difference in Android 4 vs. Android 2.3

The following code is for displaying a custom button in Android. Unfortunately, all those padding values at those different places affect the way the button is rendered only for Android 2.3, but on Android 4.X it has no effect, i.e. the padding is always the same, regardless of what you set here. Why? The layout […]

Is there a way to show the scrollbar of ListView all the time?

Is there a way to always show the vertical scroll bar of the ListView?

How to get Advertising ID in android

I want to get users Advertising ID programatically.I used the below code from the developer site.But its not working Info adInfo = null; try { adInfo = AdvertisingIdClient.getAdvertisingIdInfo(getApplicationContext()); } catch (IOException e) { // Unrecoverable error connecting to Google Play services (e.g., // the old version of the service doesn’t support getting AdvertisingId). } catch […]

DropBoxManager use cases?

I noticed that a DropBoxManager has been introduced in Android API since FroYo (API 8). It looks like an alternative logger capable of logging not only text but also files or byte arrays, but I could not find any detailed doc anywhere about how and when we should use it. The latest android dev blog […]

Android: ClassNotFoundException when passing serializable object to Activity

I have a few crash report logs from android market similar to this: Exception class: java.lang.ClassNotFoundException Source method: PathClassLoader.findClass() java.lang.RuntimeException: Unable to start activity ComponentInfo{}: java.lang.RuntimeException: Parcelable encounteredClassNotFoundException reading a Serializable object (name = at at at$2300( at$H.handleMessage( at android.os.Handler.dispatchMessage( at android.os.Looper.loop( at at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke( at […]

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