Created
April 3, 2019 14:29
-
-
Save jobinjj/adf74badc67ad803a3d731ac5766daa9 to your computer and use it in GitHub Desktop.
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
LayoutInflater inflater = getLayoutInflater(); | |
View layout = inflater.inflate(R.layout.custom_toast, | |
(ViewGroup) findViewById(R.id.custom_toast_container)); | |
TextView text = (TextView) layout.findViewById(R.id.text); | |
text.setText("This is a custom toast"); | |
Toast toast = new Toast(getApplicationContext()); | |
toast.setGravity(Gravity.CENTER_VERTICAL, 0, 0); | |
toast.setDuration(Toast.LENGTH_LONG); | |
toast.setView(layout); | |
toast.show(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment