Skip navigation

Monthly Archives: July 2014

For typical Android App with holoEverywhere and Facebook login. When you receive:

. Android is limited to 65535 methods per classes.dex
 You can either remove some methodor use a secondary framework .”

So you can use proguard this is the configuration that finally worked for me:

-optimizationpasses 5
-optimizations !code/simplification/arithmetic,!field/*,!class/merging/*,!code/allocation/variable

-keep public class * extends
-keep public class * extends
-keep public class * extends
-keep public class * extends android.content.BroadcastReceiver
-keep public class * extends android.content.ContentProvider
-keep public class * extends
-keep public class * extends android.preference.Preference
-keep public class

#modify for Facebook
-keepattributes Signature
-keep class com.facebook.model.** { *; }

-keepnames class * implements
-keepclassmembers class * implements {
    static final long serialVersionUID;
    private static final[] serialPersistentFields;
    !static !transient <fields>;
    private void writeObject(;
    private void readObject(;
    java.lang.Object writeReplace();
    java.lang.Object readResolve();

-keepclasseswithmembernames class * {
    native <methods>;

-keepclasseswithmembers class * {
    public <init>(android.content.Context, android.util.AttributeSet);

-keepclasseswithmembers class * {
    public <init>(android.content.Context, android.util.AttributeSet, int);

-keepclassmembers class * extends {
   public void *(android.view.View);

-keepclassmembers enum * {
    public static **[] values();
    public static ** valueOf(java.lang.String);

-keep class * implements android.os.Parcelable {
  public static final android.os.Parcelable$Creator *;
#Important ActionBar uses reflection methods
-keepclassmembers class * extends com.actionbarsherlock.ActionBarSherlock {
    <init>(, int);

-dontwarn org.joda.**

-keep class com.actionbarsherlock.**
-keep class org.holoeverywhere.**
-keep class**
-keep class org.apache.**
-keep class com.commonsware.**

The Elements of Amazon Maps

The Amazon Maps API consists of a core set of classes that combine to provide mapping capabilities in Android applications on the Kindle Fire. The key classes are:

MapActivity – A subclass of the Android Activity class, this provides the base class for activities that need to provide map support. Any activity that needs to work with maps must be derived from this class.
MapView – Provides the canvas onto which the map is drawn.
MapController – Provides an interface for managing an existing map. This class includes capabilities such as setting both the center coordinates of the map and the current zoom level.
ItemizedOverlay – A class specifically designed to overlay information onto a map. For example, an overlay might be used to mark all the locations of the public libraries in a town. A single overlay can contain multiple items, each represented by an OverlayItem instance. An onTap() callback method may be implemented to pop up additional information about a location when tapped by the user.
OverlayItem – Used to represent each item in an ItemizedOverlay. Each item has associated with it a location on the map and an optional image to mark the location.
MyLocationOverlay – A special-purpose overlay designed specifically to display the current location of the device on the map view.
Overlay – A general-purpose overlay class provided primarily to allow transparent effects or content to be placed on top of the map.

You can use the Original documentation from gMaps V1:


  • You need to create you MD5 certificate into your free (thx) Amazon developer account to enable the maps on your app.
  • You will need A REGISTERED KINDLE FIRE TO SEE THE MAP it does not work in other case (also enable the location on settings)
  • getLatitudeSpan() Returns the difference in microdegrees(decimal degrees multiplied by one million). between the latitude of the top edge of the MapView and the latitude of the bottom edge. * 1E6 or / 1E6
  • Useful to replace the typical markers:

Example of extension of Maps to calculate user interactions and refresh for instance the Overlay

package your_package

import android.content.Context;
import android.util.AttributeSet;
import android.view.MotionEvent;


 * Created by victoriza on 18/07/14.

public class ExplorerAmazonMapView extends MapView {

	private static final String TAG = ExplorerAmazonMapView.class.getSimpleName();

	private static final int DURATION_DEFAULT = 700;

	private OnRegionChangedListener onRegionChangedListener;
	private GeoPoint previousMapCenter;
	private int previousZoomLevel;

	// This is the duration between when the user stops moving the map around and when the onRegionEndChange event fires.
	private int changeDuration;

	private boolean isTouched = false;
	private boolean regionChanging = false;

	private Runnable onRegionEndChangeTask = new Runnable() {
		public void run() {
			regionChanging = false;
			previousMapCenter = getMapCenter();
			previousZoomLevel = getZoomLevel();
			if (onRegionChangedListener != null) {
				onRegionChangedListener.onRegionEndChange(ExplorerAmazonMapView.this, previousMapCenter, previousZoomLevel);

	public ExplorerAmazonMapView(Context context, AttributeSet attrs) {
		super(context, attrs);

	public ExplorerAmazonMapView(Context context, AttributeSet attrs, int defStyle) {
		super(context, attrs, defStyle);

	public ExplorerAmazonMapView(Context context, String apiKey) {
		super(context, apiKey);

	public boolean onTouchEvent(MotionEvent event) {
		isTouched = event.getAction() != MotionEvent.ACTION_UP;
		return super.onTouchEvent(event);

	public void computeScroll() {

		// If the map region is still changing (user is still scrolling or zooming), reset timer for onRegionEndChange.
		if ((!isTouched && !getMapCenter().equals(previousMapCenter)) || (previousZoomLevel != getZoomLevel())) {

			// If the region has just begun changing, fire off onRegionBeginChange event.
			if (!regionChanging) {
				regionChanging = true;
				if (onRegionChangedListener != null) {
					onRegionChangedListener.onRegionBeginChange(this, previousMapCenter, previousZoomLevel);

			// Reset timer for onRegionEndChange.
			postDelayed(onRegionEndChangeTask, changeDuration);

	private void init() {
		changeDuration = DURATION_DEFAULT;
		previousMapCenter = getMapCenter();
		previousZoomLevel = getZoomLevel();

	public void setOnRegionChangedListener(OnRegionChangedListener listener) {
		onRegionChangedListener = listener;

	public void setChangeDuration(int duration) {
		changeDuration = duration;

	public interface OnRegionChangedListener {
		public abstract void onRegionBeginChange(ExplorerAmazonMapView explorerMapView, GeoPoint geoPoint, int zoomLevel);

		public abstract void onRegionEndChange(ExplorerAmazonMapView explorerMapView, GeoPoint geoPoint, int zoomLevel);