getCropAndSetWallpaperIntent()在android中使用时出现此错误
D/Exception: java.lang.IllegalArgumentException: Cannot use passed URI to set wallpaper; check that the type returned by ContentProvider matches image/*
Run Code Online (Sandbox Code Playgroud)
但是当我检查Content使用类型时,ContentResolver我得到了
D/CONTENT TYPE:: IS: image/jpeg
那么为什么Wallpaper Manager给我内容错误?
这是我用来获取图像 URI 的代码
public Uri getImageUri(Context inContext, Bitmap inImage) {
ByteArrayOutputStream bytes = new ByteArrayOutputStream();
inImage.compress(Bitmap.CompressFormat.JPEG, 100, bytes);
tempPath = MediaStore.Images.Media.insertImage(inContext.getContentResolver(), inImage, "Title", null);
Log.d("URI OF SET IMAGE", tempPath);
ContentResolver cr = this.getContentResolver();
Log.d("CONTENT TYPE: ", "IS: " + cr.getType(Uri.parse(tempPath)));
return Uri.parse(tempPath);
}
Run Code Online (Sandbox Code Playgroud)
有任何想法吗 ?
android android-contentresolver android-contentprovider android-wallpaper
我有一个View.OnClickListener,Recycler View但是每当我单击视图时,它都不会触发该onClick事件
这是代码:
public class ViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener{
TextView name;
ImageView image;
Context context;
ArrayList<Categories_Model_Class> arrayList;
public ViewHolder(View view, Context context, ArrayList<Categories_Model_Class> arrayList) {
super(view);
name = view.findViewById(R.id.category_name);
image = view.findViewById(R.id.category_image);
this.context = context;
this.arrayList = arrayList;
view.setOnClickListener(this);
Log.i("Created", "ViewHolder");
}
@Override
public void onClick(View view) {
//Pair<View, String> pair1 = Pair.create((View) this.image, this.image.getTransitionName());
Intent intent = new Intent(context, FullWallpaperViewActivity.class);
//ActivityOptionsCompat optionsCompat = ActivityOptionsCompat.makeSceneTransitionAnimation((Activity)context, pair1);
context.startActivity(intent);
Log.i("TOUCH", "TOUCH");
}
}
Run Code Online (Sandbox Code Playgroud)
有什么建议?
CardView …
android onclicklistener android-viewholder android-recyclerview
我是Android应用程序开发的初学者.现在我想在我的应用程序中设置通知警报.我有一些特定的日期,我想在特定时间获得这些日期的通知.我怎么能这样做?提前致谢
android ×3