I am trying to reference an object in the current activity, but there is no way to find this easy Before I was able to do this simple passing with the "this" reference of the current context. I changed my activity again by applying OnClickListener to create an OnClickListener object so that I can pass it as a parameter, this is when I had trouble because I created the object after clicking on a button It means that I can not do the activity with "this" because "this" is now a reference to OnClickListener.
The expansion of MyActivity activity of the public class (Private object mObject; Private onclick leistner mListener = New onclick leener) (Click on Public Zero (see V) {object object = new object (this) ;}}} Public class object {Private activity mActivity; Public object (activity A) {mActivity = a; mActivity.setContentView (R.layout.layout);}} An easy fix It seems but I could not find the answer ...
Any help was greatly appreciated
You are right, this now OnClickListener < / Code> because it gives reference to the current class, and you are working inside an anonymous class. You mActivity.This : BTW: I think I can name the mActivity class Change, because the general class naming convention It starts with an uppercase letter.
Comments
Post a Comment