how can i get android inbuilt image gallery in to my application?

醉酒当歌 提交于 2019-12-23 04:50:43

问题


I have implemented an application for get the images from external storage when user click on a image button.if user click on a button i can get the images from sd card.but i can't view the slide show for get the images on by one there.I have implemented code as follows:

  ((ImageView)findViewById(R.id.getImage)).setOnClickListener(new OnClickListener() {

    @Override
    public void onClick(View v) {

        Intent intent = new Intent();
        intent.setType("image/*");
        intent.setAction(Intent.ACTION_GET_CONTENT);
        startActivity(intent);
    }
});

From the above code i am getting all images from sdcard but i can't view android inbuilt slide show image viewer.

How can i get android slide show image viewer?

please any body help me....


回答1:


use ViewFlipper

  ViewFlipper vf=(ViewFlipper)findViewById(R.id.ViewFlipper1);
  ImageView img=(imageView)findviewById(R.id.imageView1);
  Button btn=(Button)findViewById(R.id.button1);

  img.setOnClickListener(this);
  btn.setOnClickListener(this);


  public void OnClick(View v)
  {
    Switch(v.getId())
    {
       case R.id.imageView1 :

        Intent intent = new Intent();
        intent.setType("image/*");
        intent.setAction(Intent.ACTION_GET_CONTENT);
        startActivity(intent);
        vf.showNext();
        break;

        case R.id.button1:
        vf.showPrevious();
        break;
  }


来源:https://stackoverflow.com/questions/9616419/how-can-i-get-android-inbuilt-image-gallery-in-to-my-application

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!