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:
jhtop.kim
2011-07-19 20:25:02 +09:00
committed by Jake Hamby
parent b55738841b
commit bb16e15de3
2 changed files with 11 additions and 1 deletions

8
src/com/android/settings/bluetooth/Utils.java Normal file → Executable file
View 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();
}
}
}