Passing Activity to non-activity object properly

后端 未结 1 1600
执笔经年
执笔经年 2020-12-30 13:03

In my app ive got a non-activity object which it\'s role is being a manager class. many times i need to pass \"source activity\" to methods as parameter to that manager clas

1条回答
  •  离开以前
    2020-12-30 13:41

    You may try to pass application context which is getApplicationContext() on activity. Why do you have this MyManager object ? You can just raise toast from activity without having it in separate class. Move your method raiseToast() to activity body and just call it.

    EDIT: please read http://android-developers.blogspot.com/2009/01/avoiding-memory-leaks.html

    0 讨论(0)
提交回复
热议问题