Bluetooth : fix for crashing alertDialogbox
- changes for crashing of alertDialogbox while displaying message - in showError function, this fix code shoud be added in case of showing error pop up Bug: 5068089 Change-Id: I40e8a699461832b7bd47080b40f467572632d412 Signed-off-by: jhtop.kim <jhtop.kim@samsung.com>
This commit is contained in:
8
src/com/android/settings/bluetooth/Utils.java
Normal file → Executable file
8
src/com/android/settings/bluetooth/Utils.java
Normal file → Executable file
@@ -89,11 +89,17 @@ final class Utils {
|
||||
|
||||
static void showError(Context context, String name, int messageResId) {
|
||||
String message = context.getString(messageResId, name);
|
||||
new AlertDialog.Builder(context)
|
||||
LocalBluetoothManager manager = LocalBluetoothManager.getInstance(context);
|
||||
Context activity = manager.getForegroundActivity();
|
||||
if(manager.isForegroundActivity()) {
|
||||
new AlertDialog.Builder(activity)
|
||||
.setIcon(android.R.drawable.ic_dialog_alert)
|
||||
.setTitle(R.string.bluetooth_error_title)
|
||||
.setMessage(message)
|
||||
.setPositiveButton(android.R.string.ok, null)
|
||||
.show();
|
||||
} else {
|
||||
Toast.makeText(context, message, Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user