title: saving picture into drawable file or my data base android
body: <p>i have this code .. which work perfectly when i click the button i will choose a picture from my device gallery and then view it on imageview
  what i want to do is can i save the slected image into drawable file o my database ?</p>
  
  <pre><code>package com.example.testpic;
  import android.app.Activity;
  import android.content.Intent;
  import android.database.Cursor;
  import android.graphics.Bitmap;
  import android.graphics.BitmapFactory;
  import android.net.Uri;
  import android.os.Bundle;
  import android.provider.MediaStore;
  import android.util.Log;
  import android.view.View;
  import android.view.View.OnClickListener;
  import android.widget.Button;
  import android.widget.ImageView;
  public class MainActivity extends Activity 
  {
  Button btnGal;
  ImageView ivGalImg;
  Bitmap bmp;
  
  /** Called when the activity is first created. */
  @Override
  public void onCreate(Bundle savedInstanceState) 
  {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_main);
  
      btnGal         =     (Button)findViewById(R.id.btnGallary);
      ivGalImg     =     (ImageView)findViewById(R.id.ivImage);
  
      btnGal.setOnClickListener(new OnClickListener() 
      {            
          @Override
          public void onClick(View arg0) 
          {
              openGallery();                
          }
      }); 
  }
  
  private void openGallery()
  {
      Intent photoPickerIntent = new Intent(Intent.ACTION_GET_CONTENT);
      photoPickerIntent.setType("image/*");
      startActivityForResult(photoPickerIntent, 1);
  }
  
  @Override
  protected void onActivityResult(int requestCode, int resultcode, Intent intent)
  {
    super.onActivityResult(requestCode, resultcode, intent);
  
    if (requestCode == 1) 
    {
        if (intent != null &amp;&amp; resultcode == RESULT_OK) 
        {              
  
              Uri selectedImage = intent.getData();
  
              String[] filePathColumn = {MediaStore.Images.Media.DATA};
              Cursor cursor = getContentResolver().query(selectedImage, filePathColumn, null, null, null);
              cursor.moveToFirst();
              int columnIndex = cursor.getColumnIndex(filePathColumn[0]);
              String filePath = cursor.getString(columnIndex);
              cursor.close();
  
              if(bmp != null &amp;&amp; !bmp.isRecycled())
              {
                  bmp = null;                
              }
  
              bmp = BitmapFactory.decodeFile(filePath);
              ivGalImg.setBackg`enter code here`roundResource(0);
              ivGalImg.setImageBitmap(bmp);              
        }
        else 
        {
            Log.d("Status:", "Photopicker canceled");            
        }
    }
  }
  }
  </code></pre>