错误集合

1.trying to draw too large(641336400bytes) bitmap.

将高分辨率图片放在了低分辨率文件夹下

 

例如:图片的分辨率是属于xxhdpi的,但错将这张图片放在了drawable-xhdpi或者比这个还低的文件夹下,解决的办法: 

a.人为的将这张图片的分辨率降低(一般不这样做) 

b.将高分辨率的图片放在drawable-xxhdpi或者drawable-xxxhdpi下即可

2.recyclerview点击事件中的页面跳转

这里的startActivity不能使用

解决方法:

@NonNull
@Override
public ShopsAdapter.ViewHolder onCreateViewHolder(@NonNull ViewGroup viewGroup, int i) {
View view = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.information, viewGroup, false);
final ViewHolder holder = new ViewHolder(view);
holder .context=viewGroup.getContext() ;
holder.tv_shopName.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
int position = holder.getAdapterPosition();
Shops shops = list.get(position);
Toast.makeText(view.getContext(), shops.getShopName(), Toast.LENGTH_SHORT).show();
}
});
return holder;
}
以及
public ViewHolder(View view) {
super(view);
shopView =view;

tv_shopName = (TextView) view.findViewById(R.id.tv_shopName);
tv_userName = (TextView) view.findViewById(R.id.tv_userName);
btn_open = (Button) view.findViewById(R.id.btn_open);
btn_open.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
String shopName = tv_shopName.getText().toString();
Intent intent = new Intent();
intent.setClass(shopView .getContext(),ShowGoods .class );
intent.putExtra("shopName", shopName);
shopView.getContext().startActivity(intent);
}
});
}
3.The application may be doing too much work on its main thread.
意思是:主线程中有耗时操作,主线程受不了了。
(还有这种操作???)

 

posted @ 2018-11-21 15:18  iwannaeat  阅读(211)  评论(0)    收藏  举报