In .java file, put the following code:-
import android.widget.Toast;
public class activityTestToast extends Activity
{
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState)
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
//this line will pop up the message when the application is created
Toast.makeText(this, "Cikucak!!", Toast.LENGTH_SHORT).show();
}
}
NOTE:-
1. Replace the work "Cikucak" with any message you prefer.
2. Try LENGTH_SHORT or LENGTH_LONG and see the difference
It's quite simple, right?
1 comment:
You can also find a simple tutorial here - http://android-apps-blog.blogspot.com/2011/04/how-to-display-simple-toast-notificatin.html
Post a Comment