如何从一个适配器完成一项活动..? [英] How to finish an activity from an Adapter..?
本文介绍了如何从一个适配器完成一项活动..?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我试图与传递活动上下文
插入适配器,然后我试图 context.finish();
但是,它给我一个错误,如的方法完成()是未定义的类型上下文
I tried with passing context
of activity into the adapter and then i tried context.finish();
But its giving me one error like The method finish() is undefined for the type Context
推荐答案
类型强制转换。
((Activity)context).finish();
这篇关于如何从一个适配器完成一项活动..?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文