如何通过gridview位置将图像拉到另一个活动

时间:2015-07-06 07:10:27

标签: android gridview baseadapter

我想将用户从gridview中选择的图像放到另一个部门,现在:bitmaps.get(position); - 给我图像按位置为我带来所选图像,但应用程序崩溃..

一项活动的第一个代码:

GROUP BY EmpID

第二项活动:

public void onAnimationEnd(Animation animation) {
                    Intent i = new Intent(getApplicationContext(), SpcifiesImage.class);

                     binp = bitmaps.get(position);
                     bmp = binp.toString();
                    ByteArrayOutputStream stream = new ByteArrayOutputStream();
                    bitmap.compress(Bitmap.CompressFormat.PNG, 100, stream);
                    byte[] byteArray = stream.toByteArray();
                    Bundle bundle = new Bundle();
                    bundle.putString("picture", bmp.toString());
                    i.putExtra("b", bundle);
                    //  EnterParse();
                    startActivity(i);
                    // passing array index

                    // passing array index
                }

logcat的:

     im = (ImageView)findViewById(R.id.imageView3);


    Intent intent = getIntent();
    massage2 = intent.getStringExtra("mas");
    TextView texti = (TextView)findViewById(R.id.textView4);
    texti.setText(massage2);

    Bundle b = intent.getBundleExtra("bi");

    if (b == null){

    }
    else{
        try {
            String m = b.getString("image");
            myUri = Uri.parse(m);
            bitmap = BitmapFactory.decodeStream(getContentResolver().openInputStream(myUri));
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        }
        im.setImageBitmap(bitmap);
        String n = currentUser.getUsername();
        name.setText(n);

0 个答案:

没有答案