• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Error:(56, 28) error: cannot find symbol method clear()

 
Ranch Hand
Posts: 570
3
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Good day guys. I have a listView, and AllAdapter adapter where the AllAdapter is extending to BaseAdapter

Why I get error on line adapter.clear()?

Error



Code

 
 
Sheriff
Posts: 22785
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
BaseAdapter doesn't have a clear() method. That means that you will need to declare adapter as AllAdapter and not as BaseAdapter. Can you show us how you declared adapter?
 
John Joe
Ranch Hand
Posts: 570
3
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Rob Spoor wrote:BaseAdapter doesn't have a clear() method. That means that you will need to declare adapter as AllAdapter and not as BaseAdapter. Can you show us how you declared adapter?



This is how I declare adapter



And code after setContentView



And finally AllAdapter Class

 
Rancher
Posts: 5008
38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

cannot find symbol method clear()


Where do you think the method clear() is defined? What class in what package?
 
John Joe
Ranch Hand
Posts: 570
3
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Norm Radder wrote:

cannot find symbol method clear()


Where do you think the method clear() is defined? What class in what package?



I post part of my code here.

 
Norm Radder
Rancher
Posts: 5008
38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That doesn't answer my question:
Where do you think the clear() method is defined?  What class is it in?
If the compiler can not find a definition for a method it will flag that statement as an error.
 
John Joe
Ranch Hand
Posts: 570
3
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Norm Radder wrote:That doesn't answer my question:
Where do you think the clear() method is defined?  What class is it in?
If the compiler can not find a definition for a method it will flag that statement as an error.



Do you mean that I need to create a clear method in AllAdapter class ? I would like to clear all the listview item first before they added into listview.
 
Norm Radder
Rancher
Posts: 5008
38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Do you mean that I need to create a clear method in AllAdapter class ?


You can not call a method that does not exist.  If you want the AllAdapter class to have a clear method, you will have to write it.

Copied to Android section.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic