我是android新手。我正在开发图像过滤器应用程序,我的应用程序运行正常,但问题是在图像上应用过滤器时会崩溃。我已经为滤镜图像使用了回收视图,我想单击每个滤镜并将其应用于从图库加载的完整图像。 请帮助我任何人,谢谢。
我的代码是....
def estimation_value_1(event):
self.e3.insert(0, ((float(self.e1.get()))*(float(self.e2.get()))))
//主要活动
public class ThumbnailsAdapter extends `enter code here`RecyclerView.Adapter<RecyclerView.ViewHolder> {
private static final String TAG = "THUMBNAILS_ADAPTER";
private static int lastPosition = -1;
private ThumbnailCallback thumbnailCallback;
private List<ThumbnailItem> dataSet;
public ThumbnailsAdapter(List<ThumbnailItem> dataSet, ThumbnailCallback thumbnailCallback) {
Log.v(TAG, "Thumbnails Adapter has " + dataSet.size() + " items");
this.dataSet = dataSet;
this.thumbnailCallback = thumbnailCallback;
}
@Override
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup viewGroup, int i) {
Log.v(TAG, "On Create View Holder Called");
View itemView = LayoutInflater.from(viewGroup.getContext()).
inflate(R.layout.list_thumbnail_item, viewGroup, false);
return new ThumbnailsViewHolder(itemView);
}
@Override
public void onBindViewHolder(RecyclerView.ViewHolder holder, final int i) {
final ThumbnailItem thumbnailItem = dataSet.get(i);
Log.v(TAG, "On Bind View Called");
ThumbnailsViewHolder thumbnailsViewHolder = (ThumbnailsViewHolder) holder;
thumbnailsViewHolder.thumbnail.setImageBitmap(thumbnailItem.image);
thumbnailsViewHolder.thumbnail.setScaleType(ImageView.ScaleType.FIT_START);
setAnimation(thumbnailsViewHolder.thumbnail, i);
thumbnailsViewHolder.thumbnail.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (lastPosition != i) {
thumbnailCallback.onThumbnailClick(thumbnailItem.filter);
lastPosition = i;
}
}
});
}
private void setAnimation(View viewToAnimate, int position) {
{
// ViewHelper.setAlpha(viewToAnimate, .0f);
// com.nineoldandroids.view.ViewPropertyAnimator.animate(viewToAnimate).alpha(1).setDuration(250).start();
lastPosition = position;
}
}
@Override
public int getItemCount() {
return dataSet.size();
}
public static class ThumbnailsViewHolder extends RecyclerView.ViewHolder {
public ImageView thumbnail;
public ThumbnailsViewHolder(View v) {
super(v);
this.thumbnail = v.findViewById(R.id.thumbnail);
}
}
}
//出现此错误 在com.example.muhammadmehran.framefor_babyimages.Full_Image_Activity.onThumbnailClick(Full_Image_Activity.java:538) 在com.example.muhammadmehran.framefor_babyimages.ThumbnailsAdapter $ 1.onClick(ThumbnailsAdapter.java:47)