More...
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.Toast;
public class ToastSample extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
findViewById(R.id.button_long).setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
Toast.makeText(ToastSample.this, "Show Toast Long", Toast.LENGTH_LONG)
.show();
}
});
findViewById(R.id.button_short).setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
Toast.makeText(ToastSample.this, "Show Toast Short", Toast.LENGTH_SHORT)
.show();
}
});
}
}
0 件のコメント:
コメントを投稿