Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>First point, Java naming conventions have class names capitalised, this allows anybody reading the code to instantly know what's what. Please rename the <code>showImage</code> class.</p> <p>Secondly, this will cause a long running operation to happen in the UI thread, this is best done with an AsyncTask - see this article on <a href="http://developer.android.com/resources/articles/painless-threading.html" rel="nofollow">Painless Threading</a> - or a new Thread with a Handler. Long running operations on the UI thread will block any input handler events from being processed in a timely fashion and could cause your application to become unresponsive, especially with a slow mobile connection. Consider adding a progress bar or some method of letting the user know that the application is still doing something while they wait.</p> <p>To answer the original question, it looks like <code>showImage</code> is an <code>Activity</code>. This means that inside the listener you don't need to create a new <code>showImage</code> object, but rather fire off an <code>Intent</code> to view that <code>Activity</code>. Assuming you have the correct layout files I don't see anything that won't work here.</p> <p>You also seem to have an unused variable, <code>String url = null;</code> is not needed.</p> <p>Edit: You also shouldn't really be using <code>System.out.println()</code>, although it will have the desired results. The standard method of logging in Android is to use the <a href="http://developer.android.com/guide/developing/debugging/debugging-log.html" rel="nofollow">LogCat</a> system.</p> <p>As suri has mentioned, it's also not necessary to have an entire new <code>Activity</code> to show your image. If you move the <code>showImage</code> class functions into your first <code>Activity</code> and add an <code>ImageView</code> to the first layout, you can load the image in the same <code>Activity</code> as the button.</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.
    3. 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