Why does my App crash in DroidX phone?
<p>Galaxy Tab and Xperia work fine but the app crashes in droidx phone. It is happened when image select from sdcard or camera activity used I have used below code.</p>

<p>image select from sdcard</p>

<pre><code>public class select_image extends Activity
{
private static final int SELECT_PICTURE = 1;

private String filemanagerstring;
protected String _path;
protected boolean _taken;
protected static final String PHOTO_TAKEN = "photo_taken";
Bitmap bitmap;

@Override
protected void onCreate(Bundle savedInstanceState)
{
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);

Intent intent = new Intent();
intent.setType("image/*");
intent.setAction(Intent.ACTION_GET_CONTENT);
startActivityForResult(Intent.createChooser(intent,"Select Picture"), SELECT_PICTURE);
}

@Override
public void onActivityResult(int requestCode, int resultCode, Intent data)
{
if (resultCode == RESULT_OK)
{
if (requestCode == SELECT_PICTURE)
{
//CompanyInfo._ArrSelectImagePath.clear();
//ProfileDisplay.imageinMapUpdate.clear();
Uri selectedImageUri = data.getData();

CompanyInfo._StrSelectImagePath=getPath(selectedImageUri);
Log.d("FETCHIMAGEFORSElectClass", CompanyInfo._StrSelectImagePath);
bitmap = BitmapFactory.decodeFile(CompanyInfo._StrSelectImagePath);
bitmap=decodeFile();
CompanyInfo.IMBCompanyLogo.setImageBitmap(bitmap);
CompanyInfo.IMBCompanyLogo.setBackgroundColor(Color.GRAY);
finish();
//startActivity(new Intent(select_image.this,add_project1.class));
}
}
}

public String getPath(Uri uri)
{
String[] projection = { MediaStore.Images.Media.DATA };
Cursor cursor = managedQuery(uri, projection, null, null, null);
int column_index = cursor
.getColumnIndexOrThrow(MediaStore.Images.Media.DATA);
cursor.moveToFirst();
return cursor.getString(column_index);

}
private Bitmap decodeFile(){
try {
//decode image size
BitmapFactory.Options o = new BitmapFactory.Options();
o.inJustDecodeBounds = true;
BitmapFactory.decodeStream(new FileInputStream(CompanyInfo._StrSelectImagePath),null,o);

//Find the correct scale value. It should be the power of 2.
final int REQUIRED_SIZE=70;
int width_tmp=o.outWidth, height_tmp=o.outHeight;
int scale=1;
while(true){
if(width_tmp/2&lt;REQUIRED_SIZE || height_tmp/2&lt;REQUIRED_SIZE)
break;
width_tmp/=2;
height_tmp/=2;
scale++;
}

//decode with inSampleSize
BitmapFactory.Options o2 = new BitmapFactory.Options();
o2.inSampleSize=scale;
return BitmapFactory.decodeStream(new FileInputStream(CompanyInfo._StrSelectImagePath), null, o2);
} catch (FileNotFoundException e) {}
return null;
}
@Override
protected void onDestroy() {
// TODO Auto-generated method stub
super.onDestroy();
}
}
</code></pre>

<p><strong>camera activity used using this code</strong></p>

<pre><code>protected void startCameraActivity() {
_path = Environment.getExternalStorageDirectory() + "/default" + _intINC
+ ".jpg";
_intINC++;
File file = new File(_path);
Uri outputFileUri = Uri.fromFile(file);
Intent intent = new Intent (android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
intent.putExtra(MediaStore.EXTRA_OUTPUT, outputFileUri);
startActivityForResult(intent, 0);
}
//@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
switch (resultCode) {
case -1:
onPhotoTaken();
break;
}
}
protected void onPhotoTaken() {
_taken = true;
PunchListAppActivity.VARClass._StrNewPorjectImagePath= _path;
bita = BitmapFactory.decodeFile(_path);
bita = decodeFile();
IMBPictureDialog.setImageBitmap(bita);
PunchListAppActivity.VARClass._ArrPicture.clear();
PunchListAppActivity.VARClass._ArrPicture.add(PunchListAppActivity.VARClass._StrNewPorjectImagePath);
}
//@Override
protected void onRestoreInstanceState(Bundle savedInstanceState) {
if (savedInstanceState.getBoolean(PHOTO_TAKEN)) {
onPhotoTaken();
}
}
//@Override
protected void onSaveInstanceState(Bundle outState) {
outState.putBoolean(PHOTO_TAKEN, _taken);
}
private Bitmap decodeFile() {
try {
// decode image size
BitmapFactory.Options o = new BitmapFactory.Options();
o.inJustDecodeBounds = true;
BitmapFactory.decodeStream(new FileInputStream(
PunchListAppActivity.VARClass._StrNewPorjectImagePath), null, o);

// Find the correct scale value. It should be the power of 2.
final int REQUIRED_SIZE = 70;
int width_tmp = o.outWidth, height_tmp = o.outHeight;
int scale = 1;
while (true) {
if (width_tmp / 2 &lt; REQUIRED_SIZE
|| height_tmp / 2 &lt; REQUIRED_SIZE)
break;
width_tmp /= 2;
height_tmp /= 2;
scale++;
}
// decode with inSampleSize
BitmapFactory.Options o2 = new BitmapFactory.Options();
o2.inSampleSize = scale;
return BitmapFactory.decodeStream(new FileInputStream(
PunchListAppActivity.VARClass._StrNewPorjectImagePath), null, o2);
} catch (FileNotFoundException e) {
}
return null;
}
</code></pre>

<p>I have tried so many way but i cant solved this problem. have you any idea? 
Thanks!</p>
