Android Open Source - MightyToast Sample Activity






From Project

Back to project page MightyToast.

License

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.

Java Source Code

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++;
      }
    });
  }
}




Java Source Code List

com.urmwsk.mightytoast.ApplicationTest.java
com.urmwsk.mightytoast.MightyDismissListener.java
com.urmwsk.mightytoast.MightyStyle.java
com.urmwsk.mightytoast.MightyToastView.java
com.urmwsk.mightytoast.MightyToast.java
com.urmwsk.mightytoast.MightyType.java
com.urmwsk.mightytoastsample.ApplicationTest.java
com.urmwsk.mightytoastsample.SampleActivity.java