Note that there are some explanatory texts on larger screens.

plurals
  1. POhow to send imageview from one activity to other
    primarykey
    data
    text
    <p>I have an imageview in listview in first activity, I want to send my imageview into second activity on clicl of listview item.</p> <p>I have tried following code-</p> <p>Convert drawable image into bytearray:-</p> <pre><code>Bitmap bmp = BitmapFactory.decodeResource(getResources(), R.drawable.ic_launcher); ByteArrayOutputStream stream = new ByteArrayOutputStream(); bmp.compress(Bitmap.CompressFormat.PNG, 100, stream); byte[] byteArray = stream.toByteArray(); </code></pre> <p>Sending through Intent- </p> <pre><code>Intent intent=new Intent(PicturesList.this,PictureDetail.class); intent.putExtra("Bitmap", byteArray); startActivity(intent); </code></pre> <p>In second activity-</p> <pre><code>Bundle extras = getIntent().getExtras(); byteArray = extras.getByteArray("Bitmap"); </code></pre> <p>and</p> <pre><code>Bitmap bmp = BitmapFactory.decodeByteArray(byteArray, 0, byteArray.length); imageview.setImageBitmap(bmp); </code></pre> <p>But Problem is here-</p> <pre><code>Bitmap bmp = BitmapFactory.decodeResource(getResources(), R.drawable.ic_launcher); </code></pre> <p>This require drawable image and i have imageview, Can I convert my imageview into drawable? or anything alse? How to send imageview instead of drawable. Anybody have done this before.</p> <p>This is how I set image in imageview</p> <pre><code>new AsyncTask&lt;Void,Void,Void&gt;() { @Override protected Void doInBackground(Void... params) { try { URL newurl = new URL("http://java.sogeti.nl/JavaBlog/wp-content/uploads/2009/04/android_icon_256.png"); bitmap= BitmapFactory.decodeStream(newurl.openConnection().getInputStream()); //bitmap = Bitmap.createScaledBitmap(bitmap, 50,50, true); } catch (MalformedURLException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } // bitmap=imageLoader.DisplayImage("http://farm3.static.flickr.com/2199/2218403922_062bc3bcf2.jpg", imageview); //bitmap = Bitmap.createScaledBitmap(bitmap, imageview.getWidth(), imageview.getHeight(), true); return null; } @Override protected void onPostExecute(Void result) { super.onPostExecute(result); imageview.setImageBitmap(bitmap); } }.execute(); </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.
 

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