-1
選択した値を保存するにはどうすればよいですか?AlertDialogで選択した値を保存する
private final CharSequence[] mColors = {"1", "2", "3", "4", "5" , "6"};
switch (id) {
case w_COLOR:
final AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle("Тест");
builder.setSingleChoiceItems(mColors, 0, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int item) {
mResult = item;
}
});
builder.setPositiveButton("Ок", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
Toast.makeText(getApplicationContext(), "ITEM: " + mColors[mResult], Toast.LENGTH_LONG).show();
if (mResult == 0)
{
Parameters params = camera.getParameters();
params.setFlashMode(Parameters.FLASH_MODE_ON);
camera.setParameters(params);
camera.autoFocus(autoFocusCallback);
}
if (mResult == 1)
{
Parameters params = camera.getParameters();
params.setFlashMode(Parameters.FLASH_MODE_OFF);
camera.setParameters(params);
camera.autoFocus(autoFocusCallback);
}
if (mResult == 2)
{
Parameters params = camera.getParameters();
params.setFlashMode(Parameters.FLASH_MODE_ON);
camera.setParameters(params);
}
if (mResult == 3)
{
Parameters params = camera.getParameters();
params.setFlashMode(Parameters.FLASH_MODE_OFF);
camera.setParameters(params);
}
if (mResult == 4)
{
Parameters params = camera.getParameters();
params.setFlashMode(Parameters.FLASH_MODE_TORCH);
camera.setParameters(params);
camera.autoFocus(autoFocusCallback);
}
if (mResult == 5)
{
Parameters params = camera.getParameters();
params.setFlashMode(Parameters.FLASH_MODE_TORCH);
camera.setParameters(params);
}
あなたはお話をしていますか? – Marmoy