Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I believe <code>basket</code> is <code>null</code>. You need to initialize it before callling <code>put()</code> on it</p> <pre><code>Bundle basket = new Bundle(); </code></pre> <p>Knowing how to read the logcat is imperative for debugging your work. Looking at the above output</p> <pre><code>04-25 19:04:11.912: E/AndroidRuntime(999): FATAL EXCEPTION: main 04-25 19:04:11.912: E/AndroidRuntime(999): java.lang.NullPointerException 04-25 19:04:11.912: E/AndroidRuntime(999): at com.example.assignment2.MainActivity$5.onClick(MainActivity.java:121) </code></pre> <p>from here we see that there is a <code>NPE</code> at line 121 of <code>MainAcitivty</code></p> <p>*Edit**</p> <p>In <code>Second</code> change the way you get your extras. Change</p> <pre><code>Intent i = getIntent();//MAking an intent called i Bundle basket = this.getIntent().getExtras(); </code></pre> <p>to </p> <pre><code>Intent i = getIntent();//MAking an intent called i Bundle basket = i.getBundleExtra("basket"); </code></pre> <p>Since you are putting the <code>Bundle</code> into the <code>Intent</code> instead of each <code>extra</code> itself, you do it this way. If you had put each <code>extra</code> in there then you would get a <code>Bundle</code> the way you currently have it. </p> <p><a href="https://stackoverflow.com/questions/9577024/what-is-the-difference-between-getextras-and-getbundleextras">See this so answer</a> (the second one) it may make it more clear.</p> <p>In your first <code>Activity</code> change </p> <pre><code>intent.putExtras(basket); </code></pre> <p>to</p> <pre><code>intent.putExtra("basket", basket); </code></pre>
    singulars
    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. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      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