本文介绍了如何在非UI方法中使用UI函数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想创建一个具有实用程序功能的类.
I want create a own class with utility functions.
因此,我想使用典型的Activity函数并围绕它们构建一些东西.
Therefore i want to use typical Activity-functions and build something around them.
我想使用setTitle函数例如:
I want use the setTitle function for example:
public void frameworkSetTitle() { String testValue; setTitle(testValue); }是否可以在自己的类中使用此函数并将结果传递回调用方Activity?
Is it possible to use this functions in own classes and pass the result back to the calling Activity?
推荐答案您必须将Activity实例传递给util方法,并在其中调用所需的方法,例如setTtitle.
You have to pass the Activity instance to the util method and call the desired methods there, like setTtitle.
更多推荐
如何在非UI方法中使用UI函数?
发布评论