diff options
| author | Ray Chen <raychen@google.com> | 2011-08-19 10:48:49 +0800 |
|---|---|---|
| committer | Ray Chen <raychen@google.com> | 2011-08-19 10:50:24 +0800 |
| commit | 598e242e3cb97f61a1eaf71d21459e45a5b2db42 (patch) | |
| tree | ab842b9e0c18b0c8a59cdd1750d840fa0c3adb32 /src | |
| parent | f9a0a4306d589b4a4e20554fed512a603426bfa1 (diff) | |
| download | android_packages_apps_Gallery2-598e242e3cb97f61a1eaf71d21459e45a5b2db42.tar.gz android_packages_apps_Gallery2-598e242e3cb97f61a1eaf71d21459e45a5b2db42.tar.bz2 android_packages_apps_Gallery2-598e242e3cb97f61a1eaf71d21459e45a5b2db42.zip | |
Fix 5179825 Toast is created in a unprepared looper.
Change-Id: I80021755bc012340ed00fa52a20bf560369e9368
Diffstat (limited to 'src')
| -rw-r--r-- | src/com/android/gallery3d/data/LocationClustering.java | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/com/android/gallery3d/data/LocationClustering.java b/src/com/android/gallery3d/data/LocationClustering.java index 3cb1399e5..788060cf0 100644 --- a/src/com/android/gallery3d/data/LocationClustering.java +++ b/src/com/android/gallery3d/data/LocationClustering.java @@ -21,6 +21,8 @@ import com.android.gallery3d.util.ReverseGeocoder; import com.android.gallery3d.util.GalleryUtils; import android.content.Context; +import android.os.Handler; +import android.os.Looper; import android.widget.Toast; import java.util.ArrayList; @@ -38,6 +40,7 @@ class LocationClustering extends Clustering { private ArrayList<ArrayList<SmallItem>> mClusters; private ArrayList<String> mNames; private String mNoLocationString; + private Handler mHandler; private static class Point { public Point(double lat, double lng) { @@ -56,6 +59,7 @@ class LocationClustering extends Clustering { public LocationClustering(Context context) { mContext = context; mNoLocationString = mContext.getResources().getString(R.string.no_location); + mHandler = new Handler(Looper.getMainLooper()); } @Override @@ -131,8 +135,12 @@ class LocationClustering extends Clustering { } if (hasUnresolvedAddress) { - Toast.makeText(mContext, R.string.no_connectivity, - Toast.LENGTH_LONG).show(); + mHandler.post(new Runnable() { + public void run() { + Toast.makeText(mContext, R.string.no_connectivity, + Toast.LENGTH_LONG).show(); + } + }); } } |
