Questions tagged [baseadapter]

BaseAdapter is an abstract Android adapter class which is used to implement specialized adapters.

From the documentation of the BaseAdapter class:

Common base class of common implementation for an Adapter that can be used in both ListView (by implementing the specialized ListAdapter interface) and Spinner (by implementing the specialized SpinnerAdapter interface).

Tag Usage:

1659 questions
18
votes
4 answers

How to handle multiple countdown timers in ListView?

I have a listview (with a custom list adapter), I need to display a countdown on every row. For example, if my list contains 4 items, I will have 4 rows. At this point, I need to handle 4 different countdowns (one for each row) because time is…
Rob
  • 748
  • 2
  • 7
  • 16
17
votes
4 answers

Adapter with hasStableIds using GUIDs or Strings as Ids

I'm implementing a custom ArrayAdapter, and I want to set the hasStableIds to true. But the ids of my T items are Strings and the getItemId method returns longs. So, what I am currently doing is: @Override public boolean hasStableIds() { …
pomber
  • 23,132
  • 10
  • 81
  • 94
15
votes
5 answers

How could i filter the listview using baseadapter

I am trying to filter the listview but getfilter method is not working, here is the code: @Override public void afterTextChanged(Editable s) { } @Override public void beforeTextChanged(CharSequence s, int start, int count, int after)…
user2134412
14
votes
2 answers

NullPointerException when adding an object to ArrayList in Android

I'm trying to create a List View with BaseAdapter and i keep getting a Null Object Reference Error at the point of adding an object to an ArrayList. Relevant code is below: public class MainActivity extends ActionBarActivity { int[] icons =…
rapidclock
  • 1,677
  • 2
  • 17
  • 32
14
votes
3 answers

How to get context for BaseAdapter in Android

I have a class named BinderData which extends BaseAdapter. I want to get the base class context. I tried to use getContext() but that doesn't work in case of BaseAdapter. How can I get the Context of this class?
Sid
  • 582
  • 3
  • 7
  • 28
14
votes
3 answers

how to know from adapter if the item of ListView is visible or not?

I have an adapter that connected to ListView, e.g. mJournalAdapter = new JournalAdapter(); journalEntryList.setAdapter(mJournalAdapter); and I want to know inside of my JournalAdapter if some view (item of ListView) is visible or not, is it…
olegflo
  • 1,105
  • 3
  • 17
  • 26
13
votes
3 answers

Binary XML file line #17: Error inflating class caused by UnsupportedOperationException: Can't convert to dimension: type=0x2

I`ve been trying to run my app (android) but it crashes when the following Exception [LogCat] FATAL EXCEPTION: main android.view.InflateException: Binary XML file line #17: Error inflating class at…
Eman87
  • 2,735
  • 7
  • 36
  • 53
12
votes
4 answers

Create a Generic Base Adapter?

I am interested in creating a generic BaseAdapter which will apply to any ListView having any list_item . And it will set the item_row for the list_view. public class GenericAdapter extends BaseAdapter { Context context; …
Zar E Ahmer
  • 33,936
  • 20
  • 234
  • 300
12
votes
4 answers

Keep GridView when resuming from sleep mode

I got a problem with a quite large GridView.(about 70 children) The GridView works fine if I start it on onCreate or after resumeing after pressing the home button and then return. But when I resume after coming back from sleep mode, my BaseAdapter…
Magakahn
  • 498
  • 9
  • 31
11
votes
1 answer

Which Adapter to Use - BaseAdapter or ArrayAdapter?

I have a JSON string with the multiple instances of the following Name Message Timestamp Profile photo url I want to create a ListView where each list will have the above. Which is the better Adapter I need to extend for this particular case, to…
Harsha M V
  • 54,075
  • 125
  • 354
  • 529
11
votes
7 answers

Can't get values from Listview's EditText?

I'm trying to get data from EditText which is in my Listview. I saw a lot of similar questions & got a solution. But it throws an NPE in my Implementation. So please guide me to fix this issue. Adapter public class Coscho_adapter extends…
Arulnadhan
  • 923
  • 4
  • 17
  • 46
11
votes
3 answers

How to implement 2 different types of separators (i.e headers) in a ListView Adapter class

I am calling the adapter by this set of codes: mAdapter = new MyCustomAdapter(getActivity()); mAdapter.addSeparatorItem(new ContentWrapper(q.get(0).getA_name(),null)); mAdapter.addItem(new ContentWrapper(q.get(0).getAS_name(),…
Vivek Warde
  • 1,936
  • 8
  • 47
  • 77
11
votes
5 answers

how to refresh custom listview using baseadapter in android

sir, how can i refresh my custom listview using baseadapter. i don't know what to place, or where to place it in my code. please help me. thanks in advance public class EditDetails extends Activity{ public String nameChanged; public String…
Usui Takumi
  • 355
  • 2
  • 5
  • 19
10
votes
5 answers

How do I delete an item from my custom base adapter?

I am extending BaseAdapter to make a custom listview row. I have context menu that opens everytime a user holds on the row and prompts if he wants to delete it. However how do I remove the row? The hashmap is only test data. private MyListAdapter…
LuckyLuke
  • 47,771
  • 85
  • 270
  • 434
10
votes
2 answers

How to create custom BaseAdapter for AutoCompleteTextView

I've been having difficulty creating a custom ArrayAdapter for AutoCompleteTextView such errors that would come up despite following code found on the internet would be: Dropdown would not appear. Custom Objects and their details would not…