I have an activity that is launched from another activity through an intent. The intent carries an extra “id” information. Now, the launched activity has a custom view (actually, a extension of LinearLayout class). I want to access the “id” information in the custom view. Can the activity pass that value to its contained view? Or can the view get a handle to the activity?
Share
Yes, your custom View class can get a reference to the Activity it is contained in. Every View has a getContext() method which returns the Context the View is running in (i.e. your Activity).