如何将图像存储到手机图库

时间:2012-02-03 09:18:18

标签: android

    /* now i want to save my image present in imageview to phone gallery */

    private Button button1;    
    private ImageView imageView1;

    /** Called when the activity is first created. */    
    @Override
    public void onCreate(Bundle savedInstanceState) {    
        super.onCreate(savedInstanceState);    
        setContentView(R.layout.main);

        button1 = (Button)findViewById(R.id.button1);   
        button1.setOnClickListener(this);            
    }

    public void onClick(View v) {    
        // TODO Auto-generated method stub          
        if(v == button1) {    
            Intent myIntent = new Intent(PhoneImageGalleryActivity.this,PhoneImageGalleryActivity.class);
            startActivity(myIntent);                
    }

2 个答案:

答案 0 :(得分:0)

如果您将图像保存在SD卡中并运行MediaScanner,它将自动显示在库中

答案 1 :(得分:0)

添加到SDCARD的图像已由MediaScanner扫描,您不必做任何特别的事情。

添加图像时始终会创建缩略图。这是因为Thumbnail服务实际上在数据更改时非常频繁/有效地执行此操作。