Back to project page MightyToast.
The source code is released under:
Apache License
If you think the Android project MightyToast listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.urmwsk.mightytoastsample; //from ww w . ja v a 2 s . co m import android.os.Bundle; import android.support.v7.app.ActionBarActivity; import com.urmwsk.mightytoast.MightyDismissListener; import com.urmwsk.mightytoast.MightyStyle; import com.urmwsk.mightytoast.MightyToastView; import com.urmwsk.mightytoast.MightyType; public class SampleActivity extends ActionBarActivity { MightyStyle[] styles = {MightyStyle.ALERT, MightyStyle.INFO, MightyStyle.SUCCESS}; int styleterator = 0; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_sample); final MightyToastView toastView = (MightyToastView) findViewById(R.id.toast); toastView.show("This is example toast message", MightyType.TAP_TO_DISMISS, MightyStyle.SUCCESS); toastView.registerDismissListener(new MightyDismissListener() { @Override public void onToastDismiss() { toastView.show("This is example toast message " + String.valueOf(styleterator + 1), MightyType.DURATION_SHORT, styles[styleterator % 3]); styleterator++; } }); } }