Android:将图像保存到图库

时间:2014-09-09 23:50:12

标签: android

我想知道如何通过点击按钮将图像从我的应用程序库保存到我的手机库。这是代码。告诉我是否需要添加名为ImageAdapter和galleryflow的其他活动。

public class MainActivity extends Activity {
private GalleryFlow mGalleryFlow;

private int[] imageIds = new int[] { R.drawable.sdfs, R.drawable.sdfds,
        R.drawable.sdfsd, R.drawable.sdfds, R.drawable.sdf,
        R.drawable.sdfsdf, R.drawable.sdfsdf, R.drawable.sdfsu,
        R.drawable.ssdfsdf, R.drawable.sfsdfdsfs, R.drawable.sdfsfs,
        R.drawable.tisdfsd, R.drawable.tsdfdsfe };

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

     but1 = (Button) findViewById(R.id.but1);

     but1.setOnClickListener(myhandler1);

    findViews();
    initViews();
}

  View.OnClickListener myhandler1 = new View.OnClickListener() {
public void onClick(View v) {

  }
};

private void findViews() {
    mGalleryFlow = (GalleryFlow) findViewById(R.id.gf);
}

private void initViews() {
    ImageAdapter adapter = new ImageAdapter(this, imageIds);

    adapter.createReflectedImages();
    mGalleryFlow.setAdapter(adapter);
}

}

0 个答案:

没有答案