如何在Toast中获取此charSequence卷?

时间:2017-05-24 12:39:35

标签: java android

在Toast中无法找到charSequence卷。

int volume_level= am.getStreamVolume(AudioManager.STREAM_MUSIC);
if (volume_level == 0) {
    CharSequence volume = "Text...";
}
Toast toast = Toast.makeText(context, volume, Toast.LENGTH_SHORT);
toast.show();

注意:忽略此解决方案:

int volume_level= am.getStreamVolume(AudioManager.STREAM_MUSIC);
if (volume_level == 0) {
    CharSequence volume = "Text...";
    Toast toast = Toast.makeText(context, volume, Toast.LENGTH_SHORT);
    toast.show();
}

2 个答案:

答案 0 :(得分:0)

rack-timeout

答案 1 :(得分:0)

CharSequence volume = ""; if (volume_level == 0) { volume = "Text..."; }