Back to project page androidui.
The source code is released under:
MIT License
If you think the Android project androidui 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 course.examples.Notification.Toast; /*from w w w.j a v a 2 s . c om*/ import android.app.Activity; import android.os.Bundle; import android.view.Gravity; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.Toast; public class NotificationToastActivity extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); Button button = (Button) findViewById(R.id.toast_button); button.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Toast toast = Toast.makeText( getApplicationContext(), getString(R.string.youre_toast_string), Toast.LENGTH_LONG); toast.setGravity(Gravity.CENTER, 0, 0); toast.show(); } }); } }