Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Toast Java
public class BaseActvity extends Activity{
public void toast(String message, int duration) {
Toast.makeText(this, message, duration);
}
}
public class MainActvity extends BaseActvity{
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
toast("Hello, Java", Toast.LENGTH_SHORT);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment