File tree 1 file changed +9
-3
lines changed
iterableapi/src/main/java/com/iterable/iterableapi
1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change 1
1
package com .iterable .iterableapi ;
2
2
3
+ import android .app .Activity ;
3
4
import android .app .Dialog ;
4
5
import android .content .Context ;
5
6
import android .graphics .Color ;
@@ -178,15 +179,20 @@ protected void onStop() {
178
179
*/
179
180
@ JavascriptInterface
180
181
public void resize (final float height ) {
181
- getOwnerActivity ().runOnUiThread (new Runnable () {
182
+ final Activity activity = getOwnerActivity ();
183
+ if (activity == null ) {
184
+ return ;
185
+ }
186
+
187
+ activity .runOnUiThread (new Runnable () {
182
188
@ Override
183
189
public void run () {
184
190
// Since this is run asynchronously, notification might've been dismissed already
185
- if (notification == null ) {
191
+ if (notification == null || notification . getWindow () == null ) {
186
192
return ;
187
193
}
188
194
189
- DisplayMetrics displayMetrics = getOwnerActivity () .getResources ().getDisplayMetrics ();
195
+ DisplayMetrics displayMetrics = activity .getResources ().getDisplayMetrics ();
190
196
Window window = notification .getWindow ();
191
197
Rect insetPadding = notification .insetPadding ;
192
198
You can’t perform that action at this time.
0 commit comments