launchClass v setAdapter

Put problem concerning Views, Layouts and other XML-Resources (like AndroidManifest) here.

launchClass v setAdapter

Postby Exeter » Tue Jan 12, 2010 3:18 am

Hi Everyone,

I've borrowed from the Hello Gridview example which calls the sets the ImageAdapter as follows,

Call Gridview
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.  GridView gridview = (GridView) findViewById(R.id.gridview);
  2.     gridview.setAdapter(new ImageAdapter(this));
  3.  
Parsed in 0.030 seconds, using GeSHi 1.0.8.4



Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. public class ImageAdapter extends BaseAdapter {
  2. ...
  3.  
  4.       imageView.setImageResource(mThumbIds[position]);
  5.         return imageView;
  6. }
  7.  
Parsed in 0.030 seconds, using GeSHi 1.0.8.4


However, I require getResources() which only seems to work in an Activity .

1. Is there a way to get getResources() to work in a BaseAdapter class?
2. Or, is there a way to reconfigure my ImageAdapter into an Activity so that I can use launchClass(ImageAdapter.class)?


Regards,


Exeter
Exeter
Junior Developer
Junior Developer
 
Posts: 18
Joined: Tue Dec 22, 2009 4:17 pm

Top

Return to View, Layout & Resource Problems

Who is online

Users browsing this forum: Yahoo [Bot] and 5 guests