Last active
June 16, 2016 19:16
-
-
Save felipearimateia/e7a1da7786471d755f1c74770c09a385 to your computer and use it in GitHub Desktop.
Toast Java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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