Ameen Majeed
Ameen Majeed

Reputation: 21

Data passage from activity to its view

I Have an android activity with a custom view set to it. The custom view is a java class. I need to infer some methods of view from it's activity. How can I do this?

Upvotes: 0

Views: 37

Answers (1)

Srinivasan
Srinivasan

Reputation: 4661

1)Created CustomView class with extends of view(whatever you want)

2)Create a method within CustomView class like,

public void check(){
}

3)Use custom view in you xml or activity 4)Find the view from activity,

private CustomView  obj;
obj = (CustomView)findViewById(R.id.view1);

5)Now if i want to access the check method

obj.check();

Upvotes: 2

Related Questions