Android Studio. How to instantiate a method with a view in another class

0

I have a method in MainActivity2 :

public void addfoto(View view) {

// meu código bla bla bla bla

}

And I want to call this method in MainActivity . I'm trying this way but gets the code wrong:

MainActivity2 m2 = new MainActivity2();
m2.addfoto(); 

But it's not working. How I do ?

    
asked by anonymous 15.11.2017 / 22:06

0 answers