viewholder

java.util.concurrent.RejectedExecutionException in Async Task Android

匿名 (未验证) 提交于 2019-12-03 08:51:18
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: public View getView(final int position, View convertView, ViewGroup parent) { SectionHolder sectionHolder = null; ViewHolder holder = null; convertView = listAdapter.getView(getIndexForPosition(position), convertView, parent); convertView.setTag(contactsIds[getIndexForPosition(position)]); holder = new ViewHolder(); holder.txtTitle = (TextView) convertView .findViewById(R.id.list_item_title); holder.id = contactsIds[getIndexForPosition(position)]; new ThumbnailTask(holder,contactsIds[getIndexForPosition(position)]).execute(); return

android.widget.textview cannot be applied to android.view.view

匿名 (未验证) 提交于 2019-12-03 08:35:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm trying to follow the Android official doc for Creating Lists and Cards . In the third (from the top) code example in the page, there's an example on how to implement MyAdapter which provides access to the items in the dataset, creates views for items and replaces them when their no longer visible. Problem is, on onCreateViewHolder they pass v which is a View to the ViewHolder which is implemented just before that. The constructor of the ViewHolder expects a TextView . Android Studio 1.0 than shouts: android.widget.textview cannot be

Is there any way from which we can detect images are loading from cache in picasso?

匿名 (未验证) 提交于 2019-12-03 08:28:06
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: as title suggest I want to check whether images are loading from cache or not. I've done something like this but couldn't succeeded. Picasso.with(getApplicationContext()) .load(data.get(position).get("product_image")) .into(viewHolder.imgViewIcon, new Callback() { @Override public void onSuccess() { viewHolder.imgViewIcon.setVisibility(View.VISIBLE); if (Picasso.LoadedFrom.NETWORK != null) YoYo.with(Techniques.ZoomIn).duration(1200) .playOn(viewHolder.imgViewIcon); viewHolder.placeholder.setVisibility(View.GONE); } @Override public void

Android recyclerView findViewHolderForAdapterPosition returns null

匿名 (未验证) 提交于 2019-12-03 03:04:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I want to click an item in recyclerView programmatically, I found a way do that: recyclerView.findViewHolderForAdapterPosition(0).itemView.performClick(); but it doesn't work for me, the findViewHolderForAdapterPosition just returns null. Did I miss something in my code? HistoryListAdapter: public class HistoryListAdapter extends RecyclerView.Adapter { private static ArrayList recordItems; private static FragmentActivity activity; private static RecordList recordList; public HistoryListAdapter(ArrayList recordItems, FragmentActivity FA,

Sometimes Picasso doesn't load the image from memory cache

匿名 (未验证) 提交于 2019-12-03 02:54:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: private class CustomAdapter extends CursorAdapter { @Override public void bindView(View view, Context context, Cursor cursor) { if (view != null) { String url = cursor.getString(CONTENT_URL_COLUMN); ViewHolder viewHolder = (ViewHolder) view.getTag(); final ImageView imageView = viewHolder.mImageViewIcon; final TextView textView = viewHolder.mTextViewName; Picasso.with(context).load(url).into(new Target() { @Override public void onBitmapLoaded(Bitmap arg0, LoadedFrom arg1) { imageView.setImageBitmap(arg0); imageView.setVisibility(View.VISIBLE

Android Recyclerview MediaPlayer previous Item sound stop, release after new one is clicked

匿名 (未验证) 提交于 2019-12-03 02:54:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: In my app i have recyclerview items, and each item play sound when i click it. Problem is that when i click few items, they all play sounds in the same time until they finish. Lets say i click 10 items, all 10 play sounds in the same time and after some time app get crashed and i get this error: E/MediaPlayer: error (1, -19) . I avoid app crashing by implementing automatic release with this code: mediaPlayer . setOnCompletionListener ( new MediaPlayer . OnCompletionListener () { @Override public void onCompletion ( MediaPlayer mp )

StaggeredGridLayoutManager and moving items

匿名 (未验证) 提交于 2019-12-03 02:54:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have created a very simple project, displaying 28 images with StaggeredGridLayoutManager by recyclerview. but as I scroll the recyclerview it moves items for example from left to right or swap the column of left and right. codes: import java.util.ArrayList; import java.util.List; import android.app.Activity; import android.os.Bundle; import android.support.v7.widget.RecyclerView; import android.support.v7.widget.StaggeredGridLayoutManager; public class MainActivity extends Activity { String mImageDir; private RecyclerView mRecyclerView;

RecyclerView onBindViewHolder only called when getItemViewType changes

匿名 (未验证) 提交于 2019-12-03 02:45:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have a viewholder with multiple viewtypes. When scrolling onBindViewHolder is only called when getItemViewType changes value. This causes my list items to not be updated properly. Is this a bug? Or I'm i doing something wrong here. This seems very strange behaviour from the new recyclerView class. Here is my adapter: package se.davison.smartrecycleradapter; import android.content.Context; import android.support.v7.widget.RecyclerView; import android.util.Log; import android.util.SparseIntArray; import android.view.LayoutInflater; import

Picasso loading of image spawned inside AsyncTask

匿名 (未验证) 提交于 2019-12-03 02:38:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: So I am trying to use the Picasso Library for image downloading and caching. In order to get the contactUri to pass to Picasso I need to make a query to the Contacts Content Provider . Since I don't want to block the main UI thread to get the contactId, I have put this in an AsyncTask . And once I get that contactId, I make the call to Picasso in the onPostExecute() method of the AsyncTask . However, I am noticing a flickering that shows up when I scroll through my ListView quickly. It seems to me that there is an issue with the ViewHolder

NullPointerException: Attempt to invoke virtual method 'int android.graphics.Bitmap.getWidth()'

匿名 (未验证) 提交于 2019-12-03 02:30:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: public class CategoryAdapter extends BaseAdapter { Context context; ArrayList<ModelCategory> model; LayoutInflater layoutInflater; public CategoryAdapter(Activity activity, ArrayList<ModelCategory> model) { this.model = model; this.context = activity; } @Override public int getCount() { return model.size(); } @Override public Object getItem(int position) { return null; } @Override public long getItemId(int position) { return position; } @Override public View getView(int position, View convertView, ViewGroup parent) { ViewHolder viewHolder =