Note that there are some explanatory texts on larger screens.

plurals
  1. POString Not Displaying In Edit Text
    primarykey
    data
    text
    <p>I have created an intent which gets the values entered into two Edit Texts and sends them as an intent to another class when a submit button is clicked, here is the code:</p> <pre><code>Button bSubmit1 = (Button) findViewById(R.id.submit2); //Submit Button bSubmit1.setOnClickListener(new View.OnClickListener(){ public void onClick(View v) { // TODO Auto-generated method stub String entry_Minutes = entryminutes.getText().toString(); String entry_Hours = entryhours.getText().toString(); Intent i=new Intent("com.lukeorpin.theappliancekeeper.MOVINGSTRINGS"); i.putExtra("Entry_Minutes", entry_Minutes); i.putExtra("Entry_Hours", entry_Hours); startActivity(i); </code></pre> <p>the activity in the next class is then started where the strings sent in the intent are supposed to be then displayed in another two edit text's, however nothing is appearing in the two edit text boxes. Here is the other part of the code in the other class:</p> <pre><code>public class EntryStatistics extends Activity { EditText hoursBox, minutesBox; @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); setContentView(R.layout.entrystatistics); hoursBox = (EditText)findViewById(R.id.entry_hours); minutesBox = (EditText)findViewById(R.id.entry_minutes); String entry_minutes = getIntent().getStringExtra("Entry_Minutes"); if(entry_minutes!=null){ return; } String entry_hours = getIntent().getStringExtra("Entry_Hours"); if(entry_hours!=null){ return; } hoursBox.setText(entry_hours); minutesBox.setText(entry_minutes); </code></pre> <p>Can anyone be able to tell me why the values in the strings aren't being displayed in the edit texts? Nothing is displayed at all. Thanks</p> <p>Here is the full error messages:</p> <pre><code>04-14 03:00:47.300: E/AndroidRuntime(373): FATAL EXCEPTION: main 04-14 03:00:47.300: E/AndroidRuntime(373): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.lukeorpin.theappliancekeeper/com.lukeorpin.theappliancekeeper.EntryStatistics}: java.lang.NullPointerException 04-14 03:00:47.300: E/AndroidRuntime(373): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1647) 04-14 03:00:47.300: E/AndroidRuntime(373): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663) 04-14 03:00:47.300: E/AndroidRuntime(373): at android.app.ActivityThread.access$1500(ActivityThread.java:117) 04-14 03:00:47.300: E/AndroidRuntime(373): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931) 04-14 03:00:47.300: E/AndroidRuntime(373): at android.os.Handler.dispatchMessage(Handler.java:99) 04-14 03:00:47.300: E/AndroidRuntime(373): at android.os.Looper.loop(Looper.java:123) 04-14 03:00:47.300: E/AndroidRuntime(373): at android.app.ActivityThread.main(ActivityThread.java:3683) 04-14 03:00:47.300: E/AndroidRuntime(373): at java.lang.reflect.Method.invokeNative(Native Method) 04-14 03:00:47.300: E/AndroidRuntime(373): at java.lang.reflect.Method.invoke(Method.java:507) 04-14 03:00:47.300: E/AndroidRuntime(373): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839) 04-14 03:00:47.300: E/AndroidRuntime(373): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597) 04-14 03:00:47.300: E/AndroidRuntime(373): at dalvik.system.NativeStart.main(Native Method) 04-14 03:00:47.300: E/AndroidRuntime(373): Caused by: java.lang.NullPointerException 04-14 03:00:47.300: E/AndroidRuntime(373): at com.lukeorpin.theappliancekeeper.EntryStatistics.onCreate(EntryStatistics.java:34) 04-14 03:00:47.300: E/AndroidRuntime(373): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047) 04-14 03:00:47.300: E/AndroidRuntime(373): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1611) 04-14 03:00:47.300: E/AndroidRuntime(373): ... 11 more </code></pre> <p>Here is line 34 and 35:</p> <pre><code>hoursBox.setText(entry_hours); minutesBox.setText(entry_minutes); </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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