【发布时间】:2016-05-23 10:31:57
【问题描述】:
点击 RecyclerView 中的行时,我想回到上一个片段。那么如何在我的适配器中调用该函数呢?
@Override
public void onBindViewHolder(final CountryViewHolder holder, int position) {
String country = countries.get(position);
holder.tvCountrySelection.setText(country);
holder.tvCountrySelection.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
holder.tvCountrySelection.setCompoundDrawablesWithIntrinsicBounds(0, 0, R.drawable.ic_tick_17, 0);
//I want to run popBackStack() here and send String country to previous fragment.
}
});
}
【问题讨论】:
标签: android android-fragments android-recyclerview