在一项活动中,我有两项案文意见。 在菜单方面,我有办法改变案文的大小,即一种案文。 我试图这样做。
public boolean onOptionsItemSelected(MenuItem item){
switch (item.getItemId()){
case R.id.menutextSize:
final CharSequence[] items = {"Normal","Large","Larger"};
AlertDialog.Builder builder = new
AlertDialog.Builder(this);
builder.setTitle("Select TextSize");
builder.setSingleChoiceItems(items, -1,
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int item) {
Toast.makeText(getApplicationContext(), items[item],
Toast.LENGTH_SHORT).show();
}
});
builder.setPositiveButton("OK", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
int textSize = (int)mBodyText.getTextSize();
if (items[whichButton] == "Normal")
{
mTextv.setTextSize(12);
}
if (items[whichButton] == "Large")
{
mTextv.setTextSize(14);
}
if (items[whichButton] == "Larger")
{
mTextv.setTextSize(16);
}
}
});
builder.setNegativeButton("cancel", null);
builder.show();
return true;
}
t when I am clciking in the radiobutton it is showing "Force close " messsage. How can I solve this? Thank you..