mirror of
https://github.com/zxing/zxing.git
synced 2024-11-10 04:54:04 -08:00
Avoid NPE is options menu gets called before onResume (?)
git-svn-id: https://zxing.googlecode.com/svn/trunk@2264 59b500cc-1b3d-0410-9834-0bbf25fbcc57
This commit is contained in:
parent
b81971bf74
commit
a1601d1bb8
|
@ -80,7 +80,8 @@ public final class EncodeActivity extends Activity {
|
|||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
super.onCreateOptionsMenu(menu);
|
||||
menu.add(Menu.NONE, SHARE_MENU, Menu.NONE, R.string.menu_share).setIcon(android.R.drawable.ic_menu_share);
|
||||
int encodeNameResource = qrCodeEncoder.isUseVCard() ? R.string.menu_encode_mecard : R.string.menu_encode_vcard;
|
||||
boolean useVcard = qrCodeEncoder != null && qrCodeEncoder.isUseVCard();
|
||||
int encodeNameResource = useVcard ? R.string.menu_encode_mecard : R.string.menu_encode_vcard;
|
||||
menu.add(Menu.NONE, ENCODE_FORMAT_MENU, Menu.NONE, encodeNameResource)
|
||||
.setIcon(android.R.drawable.ic_menu_sort_alphabetically);
|
||||
return true;
|
||||
|
|
Loading…
Reference in a new issue