Icon
Alerter.create(this)
.setText("Alert text...")
.setIcon(R.drawable.ic_face)
.show();
On screen duration, in milliseconds
Alerter.create(this)
.setTitle("Alert Title")
.setText("Alert text...")
.setDuration(10000)
.show();
Without title
Alerter.create(this)
.setText("Alert text...")
.show();
Adding an On Click Listener
Alerter.create(ExampleActivity.this)
.setTitle("Alert Title")
.setText("Alert text...")
.setDuration(10000)
.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Toast.makeText(ExampleActivity.this, "OnClick Called", Toast.LENGTH_LONG).show();
}
})
.show();
Verbose text
Alerter.create(ExampleActivity.this)
.setTitle("Alert Title")
.setText("The alert scales to accommodate larger bodies of text. " +
"The alert scales to accommodate larger bodies of text. " +
"The alert scales to accommodate larger bodies of text.")
.show();
网友评论