android,android-adapter,recyclerview
Call scrollToPosition(0) after moving items. Unfortunately, i assume, LinearLayoutManager tries to keep first item stable, which moves so it moves the list with it.
android,android-layout,android-adapter,android-adapterview
change your clickListner as @Override public void onClick(View arg0) { final ChatMessage val = ( ChatMessage ) data.get(mPosition); if(isInternetOn()) { String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss", Locale.getDefault()).format(new Date()); downlodedMsgId = val.getId(); if (val.getMediaMIMEType().contains("IMAGE")) { localFileURL = Environment.getExternalStorageDirectory() + File.separator + "/Planetskool/Media/Images/IMG_" + timeStamp + ".png"; new DownloadFileFromURL(position).execute(val.getOnlineMediaURL()); } } and create...
android,android-layout,android-view,android-adapter,android-gridview
Aaahh.. Something we need to try, Implement method like, private View getViewByPosition(GridView gridView, int position) { int firstPosition = gridView.getFirstVisiblePosition(); int lastPosition = gridView.getLastVisiblePosition(); if ((position < firstPosition) || (position > lastPosition)) return null; return gridView.getChildAt(position - firstPosition); } Now, call this method, if (position != -1) { // I...
java,android,android-listview,android-adapter
You are declaring your adapter twice. One at class level and another one at function level in onCreate. When you try to access it on list item click it tries to access the adapter declared at class level which was never instantiated so returning null. Change StableArrayAdapter adapterZ = new...
android,listview,android-listview,android-adapter
I suspect that mItemView is the culprit here. Judging by the name, this is an instance field, so if more than one thread calls getView() in your CustomBaseAdapter, then mItemView may change which recycled view it is pointing at right under your nose. Also, I assume that getView() ends with...
android,asynchronous,nullpointerexception,android-ui,android-adapter
The best way to manage this kind of thing is through a Service. The reason is that a service can better manage background threads, even if the activity isn't running, while things like an AsyncTask will stop working when the activity is done. Take a look at this site on...
java,android,android-studio,android-adapter
First, the lack of a visibility modifier is often referred to as package-private. It is in between protected and private on the visibility scale- only other classes within the same package can override package-private methods. See Controlling Access to members of a Class for more information. The Android framework uses...
android,android-listview,android-asynctask,android-adapter
Try this: If everything else has correct set up. Then this code will Show every update from your doInBackground immediatly in the listview = good user experience! private class AsyncCaller extends AsyncTask<Void,Void,Void>{ @Override protected void onPostExecute(Void result) { // TODO Auto-generated method stub super.onPostExecute(result); findViewById(R.id.progress_bar).setVisibility(View.GONE); } @Override protected Void doInBackground(Void......
java,android,android-listview,android-adapter
In getView() after setting the text update the visibility of the textview to Visible, since listitems in the ListView will get recycled. holder.tv1.setText(getItem(position)); holder.tv2.setText(getItem(position)); holder.tv1.setVisibility(View.VISIBLE); //Your code..... Updated : public class CustomAdapter extends BaseAdapter { private ArrayList list = new ArrayList(); private Context context; public CustomAdapter(Context context) { this.context =...
android,android-listview,android-arrayadapter,android-adapter
You have to override getViewTypeCount and return number of different view type that you have: @Override public int getViewTypeCount() { return 2; } ...
android,android-fragments,android-adapter,android-recyclerview
Your adapter has a reference to mPastEventItemList. However, you are creating a new List (a new reference) in this line of code: mPastEventItemList = PastEventItem.listAll(PastEventItem.class); but your adapter is still connected to the old reference of mPastEventItemList. So you should do something like that instead: public void refreshAdapter() { mPastEventItemList.clear();...
android,android-layout,listview,android-adapter
you used viewGroup.findViewById(R.id.tvEmployeeNameSurname); but you should use like view.findViewById(R.id.tvEmployeeNameSurname);...
android,image,android-viewpager,android-adapter
If its just images then i would suggest just a Pager Adapter as there is no need for fragments.
android,android-activity,android-listview,android-adapter,android-inflate
You should remove this code in CustomAdapter rowView.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Toast.makeText(context, "You Clicked "+name[position], Toast.LENGTH_LONG).show(); } }); ...
android,android-listview,android-asynctask,android-adapter,swiperefreshlayout
I would set the list adapter up in the onCreate() method under your list view and make this a instance variable (not a local one) so that the Async task can access it as follows i.e. @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { lv = (ListView) rootView.findViewById(android.R.id.list);...
android,listview,android-listview,android-adapter,baseadapter
This sounds like a list footer, there's the possibility to add a footer view to the ListView using addFooterView. The Documentation says: public void addFooterView (View v) Add a fixed view to appear at the bottom of the list. If addFooterView is called more than once, the views will appear...
android,android-adapter,recyclerview,android-recyclerview,recycler-adapter
I created a wrapper around my adapter using this gist.And after that i can include my own layout and viewholder for my header and footer as well as the rest of the items. public class SplitMembersAdapter extends HeaderFooterRecyclerViewAdapter implements AutoCompleteContactTextView.ContactSelectListener{ private final ArrayList<SplitMember> mSplitMembersList; private final ImageLoader mImageLoader; private static...
java,android,textview,adapter,android-adapter
I believe that you are ... mistaking those two tags. setTag() can attach ANY object to the view, while the XML tag is only a string - I believe the findViewByTag will try to match the tag passed thru XML, not one attached through code - as it could be...
android,performance,android-layout,android-linearlayout,android-adapter
I have figured it out :) @TheOriginalAndroid answer is an excellent idea and response! Thank you so much for your time and help. I actually had already started implementing an AsyncTask Manager and finished it yesterday morning. I solved this by creating a class called AsycnGridManager that will manage the...
java,android,android-listview,android-adapter
Exception is in this area if (v == null) { holder = new ViewHolder(); //LayoutInflater li = LayoutInflater.from(getContext()); v = li.inflate(R.layout.trans_item, parent, false); holder.txtViewAmount = (TextView) convertView.findViewById(R.id.trans_amount); holder.txtViewDate = (TextView) convertView.findViewById(R.id.trans_date); holder.txtViewTitle = (TextView) convertView.findViewById(R.id.trans_title); convertView.setTag(holder); } you must use v instaed convertView...
android,listview,parse.com,android-adapter,onitemclicklistener
getClass is not what you want in your listener. I think you want to cast the item to the class Store. Instead of this -- String selectedFromList = (listView.getItemAtPosition(position).getClass().toString()); you want something like -- Store selectedStore = (Store) listView.getItemAtPosition(position); String selectedFromList = selectedStore.getName(); // Or whatever method you need ...
android,android-fragments,android-adapter
Alright, so I have finally figured it out this problem. Firstly, I was right about Fragment: Android does not allow you to inflate it multiple times in a same layout. Then, the solution I have found is quite easy and cleaner than using BaseAdapter. I created a MyViewPattern class and...
android,animation,listener,android-adapter,recyclerview
This is happening because LinearLayoutManager thinks the item is inserted above the first item. This behavior makes sense when you are not at the top of the list but I understand that it is unintuitive when you are at the top of the list. We may change this behavior, meanwhile,...
android,android-listview,android-adapter,onscrolllistener
When you update your Adapter's data you can save the list current selected item index and set it back when the data is rendered. Something like this: int index = mList.getFirstVisiblePosition(); // do your update stuff mList.smoothScrollToPosition(index); ...
android,android-adapter,custom-lists
Well, for what we discussed, you wanted something like this: When you want to make a custom ListView, you have to write your own adapter. In this particular case I'm subclassing the BaseAdapter class. This custom adapter will take hold of my data model, and will inflate the data to...
android,list,dynamic,android-adapter,baseadapter
Create a private class inside your adapter. This class should contain all the views which your list item has. private static class ViewHolder { NetworkImageView albumImage; TextView albumName; TextView albumPhotosCount; } And then inside getView() : ViewHolder viewHolder; if (convertView == null) { viewHolder = new ViewHolder(); LayoutInflater layoutInflater =...
java,android,android-listview,android-adapter
The spinner view does not show the view that you created in getView because you are returning convertView instead of the view you created, mViewHolder. Change return convertView; to return mViewHolder; This is a separate answer to the error you got. The error was there when you had something else...
android,android-adapter,android-gridview,baseadapter
You can use getItemIdAtPosition to compare the id against the id of headers. If it is not a header it should be the view containing your stuff. long id = mGridView.getItemIdAtPosition(i); if (id != StickyGridHeadersBaseAdapterWrapper.ID_HEADER) { // you now know that this item is not a header. View v =...
android,listview,android-adapter,baseadapter
In Adapter, getView() function is called many times. So when you go to find some view of carmen_grade_item inside listener it will return you object which was initiated in last (Means of it may point to same object of other row from listview). So to overcome this problem: If you...
android,listview,android-asynctask,android-adapter,universal-image-loader
try replacing the below line of code ((ListView) listView).setAdapter(new ImageAdapter()); with ((ListView) listView).setAdapter(mAdapter); See that for the listView you are always setting a new adapter and in your onPostExecute you are notifying to a different instance of adapter...
java,android,sorting,android-listview,android-adapter
While the first answer is the correct and most obvious way to do it, I believe an answer requires a full example: Collections.sort(apps, new Comparator<AppDetail>() { /* This comparator will sort AppDetail objects alphabetically. */ @Override public int compare(AppDetail a1, AppDetail a2) { // String implements Comparable return (a1.label.toString()).compareTo(a2.label.toString()); }...
android,android-adapter,android-gridview,android-file
Have You tried imageLoader.clearMemoryCache(); and imageLoader.clearDiscCache(); ...
android,android-adapter,android-recyclerview
Looks like you never initialize the variable adapter. So it is null. That's why you get the NPE.
You have two options: 1) Send updates to the rest API every time a piece of data is changed. This is really expensive and not something you want to do most likely. 2) Create a local data layer between your rest API and your listview - most likely an SQLite...
android,android-activity,android-adapter
Options: When creating an intent, put the data in a bundle http://developer.android.com/reference/android/os/Bundle.html, and add it to the intent. Take a look at the singleton design pattern. Create the object in one activity and it will be accessibly to the other activity. If all your data are primitive types, you can...
android,android-listview,listener,android-adapter,android-adapterview
Add tag to imageview like below : holder.image1 = (ImageView) view.findViewById(R.id.imageView1); holder.image2 = (ImageView) view.findViewById(R.id.imageView2); holder.image3 = (ImageView) view.findViewById(R.id.imageView3); holder.image4 = (ImageView) view.findViewById(R.id.imageView4); holder.image1.setTag(position); holder.image1.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { // Also having Async task Integer index = (Integer) v.getTag(); } }); ...
java,android,android-listview,android-adapter
I finally found the solution to my problem, eventhough I have no explanation why this solution works. With the following import I always had the error: import android.support.v7.widget.PopupMenu; It works fine with the following import: import android.widget.PopupMenu; I tested the code provided by Ric (Thanks for the great help!) and...
android,android-spinner,android-adapter,android-theme,appcompat
R.style.Widget_AppCompat_Light_DropDownItem_Spinner is not a layout, it needs the ID for a layout file like the first you used or like support_simple_spinner_dropdown_item.xml available in AppCompat.
android,android-layout,android-listview,android-adapter
debug the int returned by getImageId(m_context, "c" + m_list.get(position).name.toLowerCase() It is probably returning 0 or -1 which does not set images in your imageview and the view is collapsed!...
android,android-adapter,recyclerview
RecyclerView's Adapter doesn't come with many methods otherwise available in ListView's adapter. But your swap can be implemented quite simply as: class MyRecyclerAdapter{ List<Data> data; ... public void swap(ArrayList<Data> datas){ data.clear(); data.addAll(datas); notifyDataSetChanged(); } } Also there is a difference between list.clear(); list.add(data); and list = newList; The first is...
android,android-layout,android-listview,android-adapter
The inflate method is overloaded, and the two-parameter version you used in this line: headerView = mInflater.inflate(R.layout.header_list_item, parent); actually tries to add the inflated view to the AdapterView named parent (which is what caused the original UnsupportedOperationException). If you look at the source code for the LayoutInflater class (lines 364-366):...
android,android-intent,android-activity,android-adapter,android-context
You're getting an error on the mActivity = (Activity)mContext; line because the Context you're instantiating the Adapter with is not an Activity. Change the Adapter instantiation as follows: mAdapter = new MyAdapter(this, TITLES, ICONS, NAME, EMAIL, PROFILE); ...
java,android,android-webview,android-adapter,recyclerview
Fragment should be sufficient: public class WebViewFragment extends Fragment { public static final String TAG = WebViewFragment.class.getName(); public WebView mWebView; ... public void updateWebView(String url) { mWebView.loadUrl(url); } } You can always find Fragments by tag (or id): get[Support]FragmentManager().findFragmentById(int id); get[Support]FragmentManager().findFragmentByTag(String tag); and invoke methods: WebViewFragment webViewFragment = (WebViewFragment) get[Support]FragmentManager().findFragmentByTag(WebViewFragment.TAG);...
java,android,arraylist,sharedpreferences,android-adapter
If you need saving your list when activity is paused, you have several ways to do it. First you need define the private list field in your activity. private ArrayList<AppDetail> allowedApps; 1) Make AppDetail serializable and use onSaveInstanceState public class AppDetail implements Serializable { CharSequence label; CharSequence name; Drawable icon;...
android,json,android-listview,android-adapter,android-volley
Here is the solution for this Problem with changes in Adapter class. In which i placed DiskLruBasedCache.ImageCacheParams cacheParams = new DiskLruBasedCache.ImageCacheParams(mContext, "CacheDirectory"); cacheParams.setMemCacheSizePercent(0.5f); SimpleImageLoader mImageFetcher = new SimpleImageLoader(mContext, null, cacheParams); Inside if (rowView == null) which prevents to use above code repetitively in Adabpter Class....
android,android-listview,android-adapter
Error:(82, 37) error: variable adapter might not have been initialized This is indeed the case - adapter had been declared just above and not initialised, so would be null anyway if the compiler hadn't got there first. Your second method seems, at a quick glance, much more likely to...
android,listview,android-listview,android-adapter,android-switch
Solved. The problem with the OnCheckedChangeListener() is that it executes the method every single time you execute getView(). How did I solve it? Easy: I just used an onClickListener(), and the code is executed only when I click in the Switch. Now this is the result: viewHolder.isChecked1 = viewHolder.UnSwitch.isChecked(); map.put(position,...
android,android-listview,android-adapter
Comment I think you need to call this code: ListView list = (ListView) findViewById(R.id.restaurantListView); list.setAdapter(adapter); in your onActivityCreated() method for a fragment or on your onCreate() method for an Activtiy, after you have called your layout.xml file....
java,android,android-adapter,retrofit
Can you please elaborate what actually happens during a network call when I rotate the device? Will this call be lost, and then recreated because letters are present in autotextview? I have not worked with Google Places API but I think this may help you: when you rotate your...
android,android-adapter,android-resources
The device density is 165dpi thats make it mdpi device. The resolution is 320px x 480px and because its mdpi thats mean. The device is 320dp x 480dp. And from Google doc you can see this device is Normal. xlarge screens are at least 960dp x 720dp large screens are...
You did not override getViewTypeCount. You need to add @Override public int getViewTypeCount() { return 2; } in the FriendsListAdapterFromKesh class, so that your custom adapter knows how many different kinds of view to expect. Since you haven't overridden getViewTypeCount, your adapter is probably not even checking the value returned...
android,android-activity,android-sqlite,android-adapter,simplecursoradapter
As per this post multi-values syntax was introduced in SQLite version 3.7.11: "Enhance the INSERT syntax to allow multiple rows to be inserted via the VALUES clause. ". SQLite version 3.7.11 is only in Android 4.1 and up. SQLite version 3.7.11 available with API levels: 19, 18, 17, 16 SQLite...
java,android,listview,android-fragments,android-adapter
Shouldn't it be something like Adapter adapter=new Adapter(getActivity(),list,addedTask); adapter.getcount(); where list is an object of type List<Reminder_Database>. To get value from AddedTask to AddTask: public class MainActivity extends Activity{ public int count; } First set the value in AddedTask public class AddedTask extends Fragment{ .... ((MainActivity)getActivity()).count = adapter.getcount(); } To...
android,listview,android-listview,android-adapter
Dynamically Increase the text count on click in BaseAdapter Do it as using getTag/setTag: @Override public void onClick(View c) { int count=0; if(v.getTag()==null) count=0; else{ count=Integer.parseInt(v.getTag().toString()); } count++; ((TextView)v).setText("Like"+count); v.setTag(count); } ...
android,android-listview,android-adapter,android-cursoradapter
Finally I done it on my own.But instead of using Cursor Adapter I am using Base Adapter to get the output. I referred this Tutorial.I took more time to find this tutorial.It helped me a lot.Then I change some modification for the front page and for my requirement. I change...
android,listview,android-adapter
I got it. I wasn't also clearing the other arrays I was using to populate myList. After logging the various stages, I realised these arrays were duplicated so I just needed to clear them as well. This is the final work.Thanks @Lavkush2oct and @Vesko for the help. listView.setOnRefreshListener(new OnRefreshListener() {...
android,storage,android-adapter
Solved by changing the for loop in on Create: if (dirFiles.length != 0) { // loops through the array of files, outputing the name to console for (int ii = 0; ii < dirFiles.length; ii++) { File file = dirFiles[ii]; String path = file.getAbsolutePath(); SelfieRecord selfie = new SelfieRecord(); selfie.setPic(path);...
android,android-listview,android-adapter,android-viewholder
Change the implementation of getViewTypeCount and getItemViewType like: @Override public int getViewTypeCount() { return 2; } @Override public int getItemViewType(int position) { if (getItem(position).isParentOrMyObject()) { return 0; } return 1; } this way you will get two differents convertView. The one at index 0, when isParentOrMyObject() return true, the one...
java,android,listview,android-adapter
so I was under the impression that clicking the item was enough. Clicks are not selections with a ListView. A selection will occur either when: you set a selection programmatically, or the user uses a five-way navigation option (e.g., D-pad, trackball, arrow keys) and presses up/down on that to...
android,listview,android-listview,android-adapter
I got it working by using HashMap as SAM suggested. Here is what I did. in Adapter class HashMap<Long, String> map = new HashMap<Long, String>(); in getView()method of adapter if(post.postlikeflag==0){ map.put(post.postid, "like"); } else{ map.put(post.postid,"liked"); } if(map.get(post.postid).equals("like")) { holder.like.setBackgroundResource(R.drawable.like); } else { holder.like.setBackgroundResource(R.drawable.liked); } And in onclickListener of like button...
java,android,android-adapter,baseadapter,listadapter
Hoping that you are calling add2cart activity from some activity by passing bundle. check in that activity whether bundle is properly created. And to pass value "sme" to CartAdapter.java, either declare it as static String and fetch it in CartAdapter using "add2cart.sme" or pass it in constructor of CartAdapter public...
java,android,listview,android-listview,android-adapter
Instead of getChildAt() try using this public View getViewByPosition(int pos, ListView listView) { final int firstListItemPosition = listView.getFirstVisiblePosition(); final int lastListItemPosition = firstListItemPosition + listView.getChildCount() - 1; if (pos < firstListItemPosition || pos > lastListItemPosition ) { return listView.getAdapter().getView(pos, null, listView); } /*else { final int childIndex = pos -...
android,android-listview,android-adapter,numberpicker
Finally find the solution by myself. public void onClick(View v) { ArrayList<String> QrEtOccurence = new ArrayList<String>(); TextView tvNomDuQr; NumberPicker npNbJours; Integer j = 0; for (int i = 0; i < lv.getCount(); i++) { v = lv.getChildAt(i); tvNomDuQr=(TextView)v.findViewById(R.id.NomQr); npNbJours=(NumberPicker)v.findViewById(R.id.numberPickerOccurence); String NomDuQr=tvNomDuQr.getText().toString(); Integer NbJours=npNbJours.getValue(); String output = "Présenter durant "+NbJours+" jours...
android,android-adapter,android-adapterview
Create your own viewHolder for the recycler view as we always do it, and in the onBindView method, set the click listener to the view you wish to perform the click. @Override public void onBindViewHolder(final ViewHolder viewHolder, int position) { viewHolder.mRelContent.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { //...
android,android-arrayadapter,android-adapter,baseadapter,listadapter
Try it as using remove method of List and call notifyDataSetChanged : public void onClick(View v) { // delete this first list item here products.remove(0); notifyDataSetChanged(); } ...
android,listview,android-listview,android-adapter
Your getCount() method is returning 0 @Override public int getCount() { return 0; } change it to return the size of your list @Override public int getCount() { return listContact.size(); } ...
android,android-listview,android-adapter
I know exactly what you want. Do this in your layout: <ListView ... android:paddingBottom="16dp" android:clipToPadding="false" /> clipToPadding when set to false will add that space in the end of your ListView if you have added padding. Its default value is set to true and that causes the padding to stay...
android-webview,android-adapter
I solved the problem by implementing a static ViewHolder on the WebView whose reference I needed to keep longer than its views' lifecycle. private static final class WebViewHolder { WebView wv; } @Override public void onSharedPreferenceChanged(SharedPreferences pref, String key) { WebViewHolder holder = new WebViewHolder(); if (key.equals("webviewUrl")) { if (wv...
android,android-adapter,recyclerview,android-cardview
You didn't attach the adapter because you create it after you try to attach it: mRecyclerView.setAdapter(mAdapter); // Here, mAdapter is null mAdapter = new CountryAdapter(CountryManager.getInstance().getCountries(), R.layout.card_layout, getActivity()); ...
android,android-layout,android-listview,android-adapter
I think this is because of your layout file. Change the android:layout_height=wrap_content of your ListView tag to android:layout_height=match_parent.
android,listview,android-fragments,android-listview,android-adapter
You are setting null adapter so it is not refreshing. you are commented initialization part check in the following method: @Override public void onViewCreated(View view, Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); // remove the dividers from the ListView of the ListFragment settingsList = getListView(); settingsList.setDivider(null); mItems = new ArrayList<SettingsCategories>(); Resources resources...
android,textview,android-adapter,null-pointer
Just copy and paste it. @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); // navdra = getResources().getStringArray(R.array.navdra); listView = (ListView) findViewById(R.id.drawerlist); myAdapter = new MyAdapter(this); // listView.setAdapter(new ArrayAdapter<String>(this, // android.R.layout.simple_expandable_list_item_1, navdra)); listView.setAdapter(myAdapter); listView.setOnItemClickListener(this); drawerLayout = (DrawerLayout)...
android,android-adapter,android-viewholder,android-recyclerview
The problem is that you didnt reference the List of data you just passed in your constructor therefore the data list is empty: public InformationAdapter(Context context, List<Information> data) { inflator= LayoutInflater.from(context); } It should be public InformationAdapter(Context context, List<Information> data) { inflator= LayoutInflater.from(context); this.data = data; } ...
android,gridview,android-adapter,android-gridlayout
mGridLayoutManager = new GridLayoutManager(mContext, 2); mGridLayoutManager.setSpanSizeLookup(onSpanSizeLookup); /** * Helper class to set span size for grid items based on orientation and device type */ GridLayoutManager.SpanSizeLookup onSpanSizeLookup = new GridLayoutManager.SpanSizeLookup() { @Override public int getSpanSize(int position) { return mHomeListAdapter.getItemViewType(position) ) == TYPE_PREMIUM ? 2 : 1; } }; ...
android,android-adapter,onitemclicklistener
There are multiple solutions to solve this issue. You can either get the views you want to hide / show via the view you get in the onClickListener public void onItemClick(AdapterView<?> parent, View view, int position, long id) { view.findViewById(R.id.optionbackground).setVisibility(View.VISIBLE); ... } or you define the onClickListener inside your adapter...
android,android-layout,android-arrayadapter,android-adapter
You cannot actually access the resource parameter passed to the constructor, since it's private to the ArrayAdapter class. You could, however, call super.getView(), which will inflate a new View from the supplied resource id. See the ArrayAdapter code: public View getView(int position, View convertView, ViewGroup parent) { return createViewFromResource(position, convertView,...
android,image,url,android-listview,android-adapter
The easiest way to solve your problem is using some library, for example Picasso. It is not only easier to use and make your code easier to read, but also prevents you from OutOfMemory Exceptions, when images are too big. Loading image is then matter of one line: Picasso.with(context) .load(urlOfYourImage)...
android,android-listview,android-adapter
You'll need to improve your ArrayAdapter. Currently you're not setting the data to the TextView. Try the following, I didn't test it but it should work. public class CategoryAdapter extends ArrayAdapter { private LayoutInflater inflater; public CategoryAdapter(Activity activity, ArrayList<Category> items){ super(activity, R.layout.row_category, items); inflater = activity.getWindow().getLayoutInflater(); } @Override public View...
android,android-arrayadapter,android-adapter
Assign the list to a class variable and access it public class FruitAdapter extends ArrayAdapter<Fruit> { private int resourceId; private List<Fruit> mObjects; public FruitAdapter(Context context, int textViewResourceId, List<Fruit> objects) { super(context, textViewResourceId, objects); resourceId = textViewResourceId; mObjects =objects; } @Override public View getView(int position, View convertView, ViewGroup parent){ Fruit fruit...
android,android-adapter,android-recyclerview
Alright, it seems like Filters don't work well with List<> objects. I changed: filteredNames from being a List < FolderRow > object to ArrayList < FolderRow > . That got it working. ...
android,android-fragments,android-viewpager,android-adapter
Use this code adapter = new MyPagerAdapter(getChildFragmentManager()); instead of adapter = new MyPagerAdapter(getFragmentManager()); ...
android,android-listview,android-adapter
Add view having same width and height as that of Listview set visibility to INVISIBLE, in onCreate() load the data in listview check if data size greater than 0 (zero) then hide that view and if data size if its less than or equal to 0 (zero) show view. View...
android,android-adapter,retrofit
This usually works for me: @Override public int getItemCount() { return _foo == null ? 0 : _foo.size(); } returns 0 if the list of elements is null, otherwise it returns the size. This is because we know that when _foo is empty, the size is 0 because there is...
android,android-listview,android-adapter
The solution is quite simple. You have some backing data that the ListView displays via an adapter. Whenever the user click the "Load More" button, load some more data and call adapter.notifyDataSetChanged(). That's it....
android,listview,android-listview,android-adapter
Thanks @Daniel-Benedykt for pointing me in the right direction. In the end I subclassed TextView. The only place I found I could override which would work each time the view was shown was onDraw...so: public class AddressTextView extends TextView { public AddressTextView(Context context, AttributeSet attrs) { super(context, attrs); } @Override...
android,listview,android-listview,android-adapter,android-checkbox
Thankyou Richa for your help. I had an incorrect id name in the row.xml file. ...I feel like an idiot :P...
android,draw,surfaceview,android-adapter,baseadapter
Overriding draw() probably isn't what you want. If you want to draw on the View, override onDraw(). If you want to draw on the Surface, that's usually done from a separate thread. (The SurfaceView has two parts; the surface part is a completely separate layer that is drawn behind the...
android,android-layout,listview,android-listview,android-adapter
You are returning wrong count of the ArrayList in the adapter. This count is used to render the views. In your adapter change this @Override public int getCount() { // TODO Auto-generated method stub return solicitantes.size(); } ...
java,android,android-listview,android-adapter,searchview
It looks to me like your problem most likely lies in the getView(..) method of your adapter. This line in particular - Helmet helmet = getItem (position); If you are returning the item in your original array of helmets then that would explain why you're getting the results you are....
android,android-adapter,android-adapterview
I would go for the first approach. Your custom layout should be applied to only one view in the entire list, so the only thing you need to do is to avoid that such view can be recycled. I'm using this approach to load dividers at specific points in the...
android,database,android-fragments,android-adapter,recyclerview
From looking at your code, I can think of three solutions for you. In order of (my opinion) quality of the solution from least to best. Move your fragment fragmentCreateGame to be hosted by you first activity Start Activity For Result Use Otto Event Bus. I would recommend otto. Especially...
android,android-gridview,android-adapter,android-gridlayout,android-adapterview
Your ImageAdapter should extend ArrayAdapter, not BaseAdapter. Then, you only really have to worry about getView() and nothing else. And then override the constructor to load all the files from absolutes paths? Please load the images asynchronously, using a library like Picasso. Do not do disk I/O on the main...
java,android,android-listview,nullpointerexception,android-adapter
Why am I allowed to pass a null value into that function? Why wouldn't you be? After all, the ListView starts with a null adapter when you first create it. If you look at the source for ListView and its ancestors, they have lots of checks for if mAdapter...
java,android,android-activity,android-adapter,android-listfragment
Your errors pretty much tell you what you are doing wrong: Cannot resolve symbol 'myAdapter' That is because you have not declared any variable called myAdapter error: method setOnQueryTextListener in class SearchView cannot be applied to given types; required: android.support.v7.widget.SearchView.OnQueryTextListener found: android.widget.SearchView.OnQueryTextListener reason: actual argument android.widget.SearchView.OnQueryTextListener cannot be converted to...
android,android-fragments,android-listview,android-adapter,android-navigation
You seem to be using three different item types, and you're respecting convertView. This means that you might be handed a different layout by the OS than you are expecting back, as it's being recycled. For example, you might get the home layout back, which does not appear to have...
java,android,image,android-adapter,universal-image-loader
Take a look at the Picasso library: https://github.com/square/picasso It takes care of everything you need. It loads the image into your ImageView and even supports caching. It's very easy to use. ...
twitter,android-listview,onclick,android-adapter,fabric-twitter
Finally I made this works using a custom Adapter (very similar that the one you use in the question). This adapter obtains the resulting view from super implementation and adds an onClickListener to overrides the fabric defaults one: class CustomTweetTimelineListAdapter extends TweetTimelineListAdapter { public CustomTweetTimelineListAdapter(Context context, Timeline<Tweet> timeline) { super(context,...
android,android-layout,android-gridview,android-adapter
Use this as a layout! ;D <TextView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@android:id/text1" android:layout_width="match_parent" android:layout_height="match_parent" android:textAppearance="?android:attr/textAppearanceListItemSmall" android:gravity="center" android:paddingStart="?android:attr/listPreferredItemPaddingStart" android:paddingEnd="?android:attr/listPreferredItemPaddingEnd" android:minHeight="?android:attr/listPreferredItemHeightSmall" /> These are the differences.....