• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps getParent() in android with BaseAdapter

krishnaveni

Well-Known Member
Dec 16, 2011
158
0
chennai
I have to develop an one android application.

Here i have using tabgroup activity.

i have using following code on my adapter file:

HTML:
convertView.setOnClickListener(new OnClickListener() {
           @Override
           public void onClick(View v) {
                 ArrayList<SubCategory> beanSubCat = categoriesList.getmSubCategories();
                Intent intent = new Intent(getParent(),SubCategoryDetails.class);
                 TabGroupActivity parentActivity = (TabGroupActivity) getParent();
                intent.putExtra("SubCategoryDetails", beanSubCat);
                intent.putExtra("title", categoriesList.getmCategoryName());
    parentActivity.startChildActivity("SubCategoryDetails",intent);

i am getting the following error :

The method getParent() is undefined for the type new View.OnClickListener(){}

How can i resolve these error .. please give me solution for these ???



I have using adapter class here.(For eg:public class CategoriesAdapter extends BaseAdapter)how can i get the getparent() in Adapter class ??? please give me solution ???



I have using following code:

[HIGH] Intent intent = new Intent(activity,SubCategoryDetails.class);
intent.putExtra("SubCategoryDetails", beanSubCat);
intent.putExtra("title", categoriesList.getmCategoryName());
activity.startActivity(intent);[/HIGH]
Now am activity is going to next activity well.

But i have using tabgroupactivity means am getting above error ??? please give me any ideas ???
 

BEST TECH IN 2023

We've been tracking upcoming products and ranking the best tech since 2007. Thanks for trusting our opinion: we get rewarded through affiliate links that earn us a commission and we invite you to learn more about us.

Smartphones