package cem.examples.activityswitch;
import android.app.Activity;
import android.os.Bundle;
import android.text.Html;
import android.text.Spanned;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.Toast;
public class Activity1 extends Activity implements OnClickListener {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
this.setContentView(R.layout.main);
Button btn = (Button) findViewById(R.id.button1);
btn.setOnClickListener(this);
}
@Override
public void onClick(View v) {
String shtml = "İşte "
+ "ekranda"
+ " mesaj"
+ " kutusu";
Spanned sMesaj = Html.fromHtml(shtml);
Toast.makeText(this, sMesaj, Toast.LENGTH_SHORT).show();
}
}
android.widget.Toast
A toast is a view containing a quick little message for the user. The toast class helps you create and show those.
When the view is shown to the user, appears as a floating view over the application. It will never receive focus. The user will probably be in the middle of typing something else. The idea is to be as unobtrusive as possible, while still showing the user the information you want them to see. Two examples are the volume control, and the brief message saying that your settings have been saved.
The easiest way to use this class is to call one of the static methods that constructs everything you need and returns a new Toast object.
Hiç yorum yok:
Yorum Gönder