Thursday, 29 August 2013

toast in android

toast is something is like a short message one line massage that appears as like toast or short massage whenever we its one line code

Toast.makeText(this, "bla bla bla", Toast.LENGTH_SHORT).show();

this will popup massage saying bla bla bla

say now we want toast small massage when we clicked some button as we implemented button click in post
we will add above line of code inside button click

btnplay.setOnClickListener(new OnClickListener(){

@Override
public void onClick(View v) {
// TODO Auto-generated method stub
startActivity(new Intent(Intent.ACTION_VIEW,Uri.parse(https://www.google.com")));
Toast.makeText(this, "bla bla bla", Toast.LENGTH_SHORT).show();
}
        
        });

this will show bla bla message whenever we click the button have fun with toast


1 comment: