本文整理了Java中android.widget.Gallery.getSelectedItemPosition()
方法的一些代码示例,展示了Gallery.getSelectedItemPosition()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Gallery.getSelectedItemPosition()
方法的具体详情如下:
包路径:android.widget.Gallery
类名称:Gallery
方法名:getSelectedItemPosition
暂无
代码示例来源:origin: redfish64/TinyTravelTracker
@Override
public void onPause() {
super.onPause();
//TODO 2.5 the gtum can be null if we get a no arg constructor call
if(gtum != null)
gtum.unregisterMediaGalleryFragment(this);
//sometimes onCreateView isn't being called when gallery is paused (after kill and restart)
if(gallery != null)
lastGalleryPosition = gallery.getSelectedItemPosition();
}
代码示例来源:origin: LiuGuiLinAndroid/LoveWallpaper
private void setDesktopWallpaper() {
Glide.with(this).load(mListBigUrl.get(mGallery.getSelectedItemPosition())).asBitmap().into(new SimpleTarget<Bitmap>() {
@Override
public void onResourceReady(Bitmap resource, GlideAnimation<? super Bitmap> glideAnimation) {
try {
wpManager.setBitmap(resource);
Toast.makeText(GalleryActivity.this, "桌面壁纸设置成功", Toast.LENGTH_SHORT).show();
} catch (IOException e) {
Toast.makeText(GalleryActivity.this, "桌面壁纸设置失败", Toast.LENGTH_SHORT).show();
}
}
});
}
代码示例来源:origin: LiuGuiLinAndroid/LoveWallpaper
private void setLockScreenWallpaper() {
Glide.with(this).load(mListBigUrl.get(mGallery.getSelectedItemPosition())).asBitmap().into(new SimpleTarget<Bitmap>() {
@Override
public void onResourceReady(Bitmap resource, GlideAnimation<? super Bitmap> glideAnimation) {
try {
//获取类名
Class class1 = wpManager.getClass();
//获取设置锁屏壁纸的函数
Method setWallPaperMethod = class1.getMethod("setBitmapToLockWallpaper", Bitmap.class);
//调用锁屏壁纸的函数,并指定壁纸的路径imageFilesPath
setWallPaperMethod.invoke(wpManager, resource);
Toast.makeText(GalleryActivity.this, "锁屏壁纸设置成功", Toast.LENGTH_SHORT).show();
} catch (Throwable e) {
Toast.makeText(GalleryActivity.this, "锁屏壁纸设置失败", Toast.LENGTH_SHORT).show();
}
}
});
}
代码示例来源:origin: LiuGuiLinAndroid/LoveWallpaper
private void setAllWallpaper() {
Glide.with(this).load(mListBigUrl.get(mGallery.getSelectedItemPosition())).asBitmap().into(new SimpleTarget<Bitmap>() {
@Override
public void onResourceReady(Bitmap resource, GlideAnimation<? super Bitmap> glideAnimation) {
try {
//获取类名
Class class1 = wpManager.getClass();
//获取设置锁屏壁纸的函数
Method setWallPaperMethod = class1.getMethod("setBitmapToLockWallpaper", Bitmap.class);
//调用锁屏壁纸的函数,并指定壁纸的路径imageFilesPath
setWallPaperMethod.invoke(wpManager, resource);
Toast.makeText(GalleryActivity.this, "锁屏壁纸设置成功", Toast.LENGTH_SHORT).show();
} catch (Throwable e) {
Toast.makeText(GalleryActivity.this, "锁屏壁纸设置失败", Toast.LENGTH_SHORT).show();
}
try {
wpManager.setBitmap(resource);
Toast.makeText(GalleryActivity.this, "桌面壁纸设置成功", Toast.LENGTH_SHORT).show();
} catch (IOException e) {
Toast.makeText(GalleryActivity.this, "桌面壁纸设置失败", Toast.LENGTH_SHORT).show();
}
}
});
}
代码示例来源:origin: LiuGuiLinAndroid/LoveWallpaper
case R.id.iv_preview_down:
RxVolley.download(FileUtils.getSDCardPath() + "/LoveWallpaper/" + System.currentTimeMillis() + ".png"
, mListBigUrl.get(mGallery.getSelectedItemPosition())
, new ProgressListener() {
@Override
内容来源于网络,如有侵权,请联系作者删除!