这是indexloc提供的服务,不要输入任何密码
Skip to content

Commit d0e8805

Browse files
Fixed: Fix "android.view.WindowManager$BadTokenException: Unable to add window exception" when switching to landscape mode
1 parent e0d184e commit d0e8805

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

app/src/main/java/com/termux/tasker/EditConfigurationActivity.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ private void checkIfPluginHostHasPermissionRunCommand() {
292292
}
293293

294294
private void processExecutablePath(String executable) {
295-
if (mExecutablePathText == null) return;
295+
if (mExecutablePathText == null || mExecutablePathText.getWindowToken() == null) return;
296296

297297
boolean validate = true;
298298
boolean executableDefined = true;
@@ -417,12 +417,12 @@ else if (executablePathText.startsWith("$PREFIX/") || executablePathText.startsW
417417
executableFileNamesAdaptor.clear();
418418
executableFileNamesAdaptor.addAll(new ArrayList<>(Arrays.asList(executableFileNamesList)));
419419
executableFileNamesAdaptor.notifyDataSetChanged();
420-
if (mExecutablePathText.isFocused())
420+
if (mExecutablePathText.isFocused() && mExecutablePathText.getWindowToken() != null)
421421
mExecutablePathText.showDropDown();
422422
}
423423

424424
private void processWorkingDirectoryPath(String workingDirectory) {
425-
if (mWorkingDirectoryPathText == null) return;
425+
if (mWorkingDirectoryPathText == null || mWorkingDirectoryPathText.getWindowToken() == null) return;
426426

427427
boolean validate = true;
428428
boolean workingDirectoryDefined = true;
@@ -537,7 +537,7 @@ else if (workingDirectoryPathText.startsWith("$PREFIX/") || workingDirectoryPath
537537
workingDirectoriesNamesAdaptor.clear();
538538
workingDirectoriesNamesAdaptor.addAll(new ArrayList<>(Arrays.asList(workingDirectoriesNamesList)));
539539
workingDirectoriesNamesAdaptor.notifyDataSetChanged();
540-
if (mWorkingDirectoryPathText.isFocused())
540+
if (mWorkingDirectoryPathText.isFocused() && mWorkingDirectoryPathText.getWindowToken() != null)
541541
mWorkingDirectoryPathText.showDropDown();
542542
}
543543

0 commit comments

Comments
 (0)