• R/O
  • HTTP
  • SSH
  • HTTPS

提交

标签
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

packages/apps/Gallery2


Commit MetaInfo

修订版598e242e3cb97f61a1eaf71d21459e45a5b2db42 (tree)
时间2011-08-19 11:50:24
作者Ray Chen <raychen@goog...>
CommiterRay Chen

Log Message

Fix 5179825 Toast is created in a unprepared looper.

Change-Id: I80021755bc012340ed00fa52a20bf560369e9368

更改概述

差异

--- 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;
2121 import com.android.gallery3d.util.GalleryUtils;
2222
2323 import android.content.Context;
24+import android.os.Handler;
25+import android.os.Looper;
2426 import android.widget.Toast;
2527
2628 import java.util.ArrayList;
@@ -38,6 +40,7 @@ class LocationClustering extends Clustering {
3840 private ArrayList<ArrayList<SmallItem>> mClusters;
3941 private ArrayList<String> mNames;
4042 private String mNoLocationString;
43+ private Handler mHandler;
4144
4245 private static class Point {
4346 public Point(double lat, double lng) {
@@ -56,6 +59,7 @@ class LocationClustering extends Clustering {
5659 public LocationClustering(Context context) {
5760 mContext = context;
5861 mNoLocationString = mContext.getResources().getString(R.string.no_location);
62+ mHandler = new Handler(Looper.getMainLooper());
5963 }
6064
6165 @Override
@@ -131,8 +135,12 @@ class LocationClustering extends Clustering {
131135 }
132136
133137 if (hasUnresolvedAddress) {
134- Toast.makeText(mContext, R.string.no_connectivity,
135- Toast.LENGTH_LONG).show();
138+ mHandler.post(new Runnable() {
139+ public void run() {
140+ Toast.makeText(mContext, R.string.no_connectivity,
141+ Toast.LENGTH_LONG).show();
142+ }
143+ });
136144 }
137145 }
138146