Since you are writing your own adapter, why not just pass in a Context as a
parameter to your adapter's constructor?

Thanks,
Justin Anderson
MagouyaWare Developer
http://sites.google.com/site/magouyaware


On Thu, Aug 2, 2012 at 11:37 AM, bob <[email protected]> wrote:

> So, I wrote my own version of a list adapter.
>
> Here's part of it:
>
> public class Content_Adapter implements ListAdapter {
>
> @Override
>  public View getView(int position, View convertView, ViewGroup parent) {
>
> Blu_Button n = new Blu_Button(Device_List_Activity.act);
>
> So, I'm creating a custom button and returning it.  The issue is that the
> Blu_Button
> constructor wants a Context, and I don't really know how to get it.  So, I
> pass in this
> global pointer I made for the activity.  I know that's bad.
>
> In general, I was told I should add Context as a parameter to all my
> functions when I
> need it.  But, I can't add it to getView because I'm implementing a
> pre-existing
> interface.  Anyone know what the "right" thing to do here is?
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to