1
I am using a standard android Activity, the "Navigation Drawer Activity", and There is a button in the navigation bar
public boolean onOptionsItemSelected(MenuItem item) {
if (mDrawerToggle.onOptionsItemSelected(item)) {
return true;
}
if (item.getItemId() == R.id.action_example) {
Toast.makeText(getActivity(), "Example action.", Toast.LENGTH_SHORT)
.show();
//getActivity().drawGraph();
return true;
}
And I would like to call the drawGraphic() method from my main Activity only when pressing the boot
It is worth mentioning that this navigation bar is a Fragment
@Andrey I’m not really sure if the above code solves the problem, but do a cast from a generic type to a specific type is an output to call some method of the specific type. However, I agree that the ideal would be for Matthew to explain the code so that the answer has a more comprehensive usefulness.
– utluiz
It worked. Thank you very much. Then I’ll research why it worked.
– gustavo Pacheco