Note that there are some explanatory texts on larger screens.

plurals
  1. POsetText on numeric TextField forces the application to close
    text
    copied!<p>I have been having trouble with setting an initial input on my EditTexts. Whenever I pass an intent containing a string from previous activity, it leads to a forced close. </p> <p>The main gist of my program is that, a previous activity sends an intent containing a string to the editText activity. If it's not initialized, editTexts are blank, else, they contain the values shown in the TextView from the previous screen. Here is my code:</p> <pre><code>EditText month, day, year; @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); setContentView(R.layout.lab2_082588birthday); Intent startUp = getIntent(); String receivedString = startUp.getStringExtra(Lab2_082588part2.BIRTHDAY_STRING); if(receivedString.trim().length() &gt; 0){ String[] separated = receivedString.split("/"); int stringMonth = Integer.parseInt(separated[0]); int stringDay = Integer.parseInt(separated[1]); int stringYear = Integer.parseInt(separated[2]); month.setText(stringMonth); day.setText(stringDay); year.setText(stringDay); } } </code></pre> <p>Here is my <strong>LogCat</strong></p> <pre><code>07-06 15:05:19.918: E/AndroidRuntime(276): Caused by: java.lang.NullPointerException 07-06 15:05:19.918: E/AndroidRuntime(276): at com.android.rondrich.Lab2_082588birthday.onCreate(Lab2_082588birthday.java:34) 07-06 15:05:19.918: E/AndroidRuntime(276): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047) 07-06 15:05:19.918: E/AndroidRuntime(276): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627) </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload