I have to develop an one android application.
Here i have using tabgroup activity.
i have using following code on my adapter file:
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 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 ???
EDIT:
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 ???
EDIT:
I have using following code:
Intent intent = new Intent(activity,SubCategoryDetails.class);
intent.putExtra("SubCategoryDetails", beanSubCat);
intent.putExtra("title", categoriesList.getmCategoryName());
activity.startActivity(intent);
Now am activity is going to next activity well.
But i have using tabgroupactivity means am getting above error ??? please give me any ideas ???
Try this code,
Activity activity;
Intent intent = new Intent(activity.getParent(),SubCategoryDetails.class);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.