Another time-saver! Creating String resources directly from Code editor

Write a string literal in your code like

mButton.setText("Text to add as String resource");

Then select the string literal  like this:

 1-select-text

and press ALT+SHIFT+A, a yellow menu will appear in the bottom-right corner,

2-bottom-menu

double click on “Extract Android String” , this menu will appear:

2.-add-str-res

choose a proper name for the String resource and click Ok.

You will get a new strings.xml entry:

   <string name="my_string_resource">Text to add as string resource</string>

And your Button’s setText line replaced by:

   mButton.setText(R.string.my_string_resource);
Advertisements

Installation error: INSTALL_PARSE_FAILED_BAD_MANIFEST

just for time-saving…

If you get the following error when deploying an Android App to device:

Installation error: INSTALL_PARSE_FAILED_BAD_MANIFEST
Please check logcat output for more details.
Launch canceled!

In device, go to Settings and Enable Mock Locations.