Android开从视图托管活动 [英] Android get hosting Activity from a view
本文介绍了Android开从视图托管活动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个活动
3 的EditText
和它充当一个专门的键盘将信息添加到自定义视图在的EditText
秒。
I have an Activity
with 3 EditText
s and a custom view which acts a specialised keyboard to add information into the EditText
s.
目前,我通过了活动
到视图,这样我可以得到当前焦点编辑文本和更新的自定义键盘的内容。
Currently I'm passing the Activity
into the view so that I can get the currently focused edit text and update the contents from the custom keyboard.
有没有引用父活动和获得的方式,目前主要集中的EditText
不通过活动进入看法?
Is there a way of referencing the parent activity and getting the currently focused EditText
without passing the activity into the view?
推荐答案
下面的方法可以帮助你。
following methods may help you
1. Activity host = (Activity) view.getContext()
2. view.isFocused()
这篇关于Android开从视图托管活动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文