I have only a single Activity called MainActivity. It has a function which has to called from another class which is in a different module
public class MainActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.menu_main, menu);
return true;
}
public void tag_proc(String s1)
{
System.out.println("working i guess"+s1)
}
}
This function has to be called from another class from another module
public class NewCls {
MainAcitivity mact= new MainActivity();
public void dothis()
{
String s="new";
mact.tag_proc(s);
}
}
This cannnot be done because they are in different modules. What is the best and easy solution for this. If interface is a solution, how best to use it