@Override
public void onClick(View v) {
try {
//Write fileObject tag = imageView.getTag();
//Bitmap bmp = BitmapFactory.decodeResource(getResources(),R.drawable.c);
Bitmap bmp= BitmapFactory.decodeResource(getResources(),v.getResources().getResourceName((Integer)v.getTag()));
String filename = "bitmap.png";
FileOutputStream stream = getApplicationContext().openFileOutput(filename, Context.MODE_PRIVATE);
bmp.compress(Bitmap.CompressFormat.PNG, 100, stream);
//Cleanup
stream.close();
bmp.recycle();
我想從viewPager添加圖像ID而不是R.drawable.img1,any1請任何幫助嗎? 我已編輯我的問題,instaed從drawable獲取圖像,我需要在viewPager上獲取它當前的圖像。我該怎麼做?如何獲取顯示在當前圖像的ID viewPager
解釋更多信息,請。 – 2014-10-27 06:33:23
在這裏,你會發現你需要什麼 - http://stackoverflow.com/questions/21015801/get-current-id-of-image-which-is-showing-on-view-pager – 2014-10-27 06:37:02
http://androidopentutorials.com/android-image-slideshow-using-viewpager/ – 2014-10-27 06:37:14