Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Your problem is that you are trying to access <code>extras</code> in your <code>Intent</code> but you aren't passing any. You do in the <code>Intent</code> below which is why that one works</p> <pre><code>intent.putExtra("picture", b); </code></pre> <p>but you don't do this in your other <code>onClick()</code>. You will either make sure that you are sending <code>extras</code> or to be safe do a <code>null</code> check in your <code>SecondActivity</code> with something like</p> <pre><code> Bundle extras = getIntent().getExtras(); //line18 if (getIntent().getExtras() != null) { byte[] b = extras.getByteArray("picture"); } </code></pre> <p>Then of course you will need to handle the lines below that if it is <code>null</code>.</p> <p><strong>Edit</strong></p> <p>If the two <code>Button</code>s will do generally the same thing then you can <a href="https://stackoverflow.com/questions/15845181/onclick-method-issue/15845248#15845248">See this answer</a> to use the same method for both. Then you just <code>switch</code> on the <code>id</code> of the <code>View</code> to use different code depending on which was clicked. Something like</p> <pre><code> @Override public void onClick(View v) { // arg0 is an ugly name for a param so I changed it to v switch (v.getId()) { case (R.id.Floaterimg): // do stuff if this image is clicked; break; case (R.id.journbtn): // do stuff if this image is clicked; break; } } </code></pre> <p>then put common code such as your <code>Intent</code> outside of the <code>switch</code> statement.</p>
    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