1. Create an Android project, if you don't already have one.
2. In the MainActivity.java file, add your new variable between the public class and the onCreate method. Below the String variable myString is declared class-level.
public class MainActivity extends Activity {
String myString;
@Override
public void onCreate(Bundle savedInstanceState) {
....
3. Compile and run!
Resources:
Popular Posts
- Change the line spacing between lines of text in an TextView/EditText, using lineSpacingExtra
- Solution: error: Error parsing XML: unbound prefix
- How to Add a Toast
- How to Create a ProGuard Exception
- How to Set Permission for I/O Operations over NFC
- How to Install an SDK package
- findViewbyID - How to Find a RatingBar using ID
- How to Register an Activity that Responds to NFC tags for URI's that point to a URL
- String.valueOf - How to Convert a Double to a String
- Solution: Running Android Lint has encountered a problem Failed