App performance is slow down since camera image was stored in imageview.
Sometimes application is down. how to fix it??
public void onClick(View v) {
if(v.getId() == camerabutton.getId()){
addImageView();
}
}
private void addImageView(){
Intent intent = new Intent(Intent.ACTION_PICK);
intent.setType(MediaStore.Images.Media.CONTENT_TYPE);
intent.setData(MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
startActivityForResult(intent, REQ_CODE_SELECT_IMAGE);
}
@Override
protected void onActivityResult(int requestCode , int resultCode , Intent data) {
if(requestCode == 100){
if(resultCode == Activity.RESULT_OK){
ImageView imageView = new ImageView(this);
ViewGroup.LayoutParams params = new ViewGroup.LayoutParams(postArea.getWidth(), ViewGroup.LayoutParams.WRAP_CONTENT);
imageView.setLayoutParams(params);
//params.width = postArea.getWidth();
imageView.setLayoutParams(params);
Uri imgUri = data.getData();
imageView.setImageURI(imgUri);
postArea.addView(imageView);
}
}
}
}
postArea is LinenerLayout~ This code is add imageView to Layout
Aucun commentaire:
Enregistrer un commentaire