Skip to content

Commit b1a1e5c

Browse files
Craig MautnerAndroid (Google) Code Review
authored andcommitted
Merge "Use correct WindowManager for Toast." into jb-mr1-dev
2 parents 0d43c56 + b6ee2a2 commit b1a1e5c

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

core/java/android/widget/Toast.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -305,12 +305,14 @@ static private INotificationManager getService() {
305305

306306
private static class TN extends ITransientNotification.Stub {
307307
final Runnable mShow = new Runnable() {
308+
@Override
308309
public void run() {
309310
handleShow();
310311
}
311312
};
312313

313314
final Runnable mHide = new Runnable() {
315+
@Override
314316
public void run() {
315317
handleHide();
316318
// Don't do this in handleHide() because it is also invoked by handleShow()
@@ -329,7 +331,7 @@ public void run() {
329331

330332
View mView;
331333
View mNextView;
332-
334+
333335
WindowManager mWM;
334336

335337
TN() {
@@ -350,6 +352,7 @@ public void run() {
350352
/**
351353
* schedule handleShow into the right thread
352354
*/
355+
@Override
353356
public void show() {
354357
if (localLOGV) Log.v(TAG, "SHOW: " + this);
355358
mHandler.post(mShow);
@@ -358,6 +361,7 @@ public void show() {
358361
/**
359362
* schedule handleHide into the right thread
360363
*/
364+
@Override
361365
public void hide() {
362366
if (localLOGV) Log.v(TAG, "HIDE: " + this);
363367
mHandler.post(mHide);
@@ -370,7 +374,8 @@ public void handleShow() {
370374
// remove the old view if necessary
371375
handleHide();
372376
mView = mNextView;
373-
mWM = (WindowManager)mView.getContext().getSystemService(Context.WINDOW_SERVICE);
377+
mWM = (WindowManager)mView.getContext().getApplicationContext()
378+
.getSystemService(Context.WINDOW_SERVICE);
374379
// We can resolve the Gravity here by using the Locale for getting
375380
// the layout direction
376381
final Configuration config = mView.getContext().getResources().getConfiguration();

0 commit comments

Comments
 (0)