标签:des style c class blog code
1、
Intent intent = new Intent(Intent.ACTION_GET_CONTENT); intent.setType("image/*"); intent.putExtra("crop", true); intent.putExtra("return-data", true); startActivityForResult(intent, 2); protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (resultCode == RESULT_OK) { System.out.println("requestCode" + requestCode); if (requestCode == 2) { Uri uri = data.getData(); ContentResolver cr = this.getContentResolver(); try { Bitmap bmp = BitmapFactory.decodeStream(cr .openInputStream(uri)); img1.setImageBitmap(bmp); img1.setVisibility(View.VISIBLE); } catch (FileNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } }
Done
标签:des style c class blog code
原文地址:http://www.cnblogs.com/xingyyy/p/3746905.html