How to throw an exception for non-existence image choose
<p>in my scenario I choose an picture from gallery and show it in my imageView on the same layout and i can process to another activity using the image. But i have an force stop when i didnt choose any image when click the intent button. </p>

<p>Who have the idea on solving this?</p>

<pre><code>public void onCreate(Bundle savedInstanceState){

    super.onCreate(savedInstanceState);
    setContentView (R.layout.browse_page);

    //action for browse Image

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


    //declare image and button
    image = (ImageView) findViewById (R.id.image);
    chooseNewImage = (Button) findViewById (R.id.chooseNewImage);
    grayScale = (Button) findViewById (R.id.greyscale);

    //back to previous page
    chooseNewImage.setOnClickListener(new View.OnClickListener() {

        public void onClick(View v) {
            // TODO Auto-generated method stub
            finish();
        }
    });

    //go to set the image to grayScale
    grayScale.setOnClickListener(new View.OnClickListener() {

        public void onClick(View v) {

                Intent greyScale = new Intent(browsePage.this, grayScale.class);
                greyScale.putExtra("imagePath", path_selectedImage);
                startActivity(greyScale);

        }
    }); 
}

    public void onActivityResult(int requestCode, int resultCode, Intent data) {
        if (resultCode == RESULT_OK &amp;&amp; requestCode == SELECT_PICTURE) {


                    Uri_selectedImage = data.getData();
                    path_selectedImage = getPath(Uri_selectedImage);                   
                    image.setImageURI(Uri_selectedImage);
                    System.out.println(path_selectedImage);
                    Toast.makeText(getBaseContext(), "Your selected picture", Toast.LENGTH_SHORT).show(); 
             }


    }

    private String getPath(Uri uri) {
        // TODO Auto-generated method stub
        String[] project = {MediaStore.Images.Media.DATA};
        Cursor c = managedQuery(uri, project, null, null, null);
        startManagingCursor(c);
        int column_index = c.getColumnIndexOrThrow(MediaStore.Images.Media.DATA);
        c.moveToFirst();
        return c.getString(column_index);


}
</code></pre>

<p>whenever i didnt choose an image and i press the grayscale button, it force stop. Is it need to put try-catch?</p>
