0

I am creating a hashmap and passing it to another activity here is my code

bt6.setOnClickListener(new OnClickListener() {          
    @Override
    public void onClick(View v) {
        Intent intent = new Intent(gkwebbrowserActivity.this, Icons.class);
        intent.putExtra("hashmap", orderMap);
        try {
            startActivity(intent);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
});

And in my second activity I am creating set of image buttons and setting image bitmap stored in hashmap here is code for second activity

public class Icons extends Activity {
    GridLayout gl;
    ImageButton imb1;
    HashMap<Integer, Bitmap> ordermap;
    int i;
    /* (non-Javadoc)
     * @see android.app.Activity#onCreate(android.os.Bundle)
     */
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.icon);
                try {
             ordermap= new HashMap<Integer, Bitmap>();
             ordermap = (HashMap<Integer, Bitmap>) getIntent().getSerializableExtra("hashmap");
        } catch (ClassCastException e) {
            e.printStackTrace();
        }
                gl=(GridLayout)findViewById(R.id.layout);
                i=ordermap.size();
                gl.setUseDefaultMargins(true);
                gl.setColumnCount(2);
                gl.setRowCount(i/2);

                 Iterator entries = ordermap.entrySet().iterator();
                 while (entries.hasNext()) {
                   Entry thisEntry = (Entry) entries.next();
                      imb1 = new ImageButton(this);
                      imb1.setImageBitmap((Bitmap)thisEntry.getValue());
                      gl.addView(imb1); 
                  }
    }
}

But the second activity is not getting started and first activity crashes after calling second acivity.I am storing bitmaps in hashmap after that I am calling second activity.Can anybody tell me what is the problem and how to remove it This is logcat

D/dalvikvm(925): GC_CONCURRENT freed 429K, 8% free 10618K/11463K, paused 8ms+4ms
D/Capturing screenshot of webview(925): First screenshot
D/dalvikvm(925): GC_FOR_ALLOC freed 4K, 8% free 10614K/11463K, paused 76ms
I/dalvikvm-heap(925): Grow heap (frag case) to 11.249MB for 855616-byte allocation
D/dalvikvm(925): GC_CONCURRENT freed <1K, 8% free 11450K/12359K, paused 4ms+11ms
W/EGL_emulation(925): eglSurfaceAttrib not implemented
E/JavaBinder(925): !!! FAILED BINDER TRANSACTION !!!
rekire
  • 47,260
  • 30
  • 167
  • 264
  • can u paste the line which will give the error or any execption.Bcz without error code can't tell perfectly – Nency Oct 01 '12 at 07:59
  • Tag-JAVA BINDER TEXT- !!!FAILED BINDER TRANSACTION!!! – user1492793 Oct 01 '12 at 08:21
  • in which activity this error is come.activity1 or activity2? – Nency Oct 01 '12 at 08:24
  • I have posted logcat ,error is coming in activity one – user1492793 Oct 01 '12 at 08:27
  • try {startActivity(intent);} After removing try catch and pressing button to start the activity I am getting failed binder transaction again and again – user1492793 Oct 01 '12 at 08:31
  • I think you can not pass the hashmap value directly in putextra.See this link http://stackoverflow.com/questions/4992097/android-how-to-pass-hashmapstring-string-between-activities for pass the hashmap value – Nency Oct 01 '12 at 08:32

0 Answers0