I have the following code to do something when a button is pressed. I would like to be able to have the button create a calendar event for March 3rd, 2013 at 10:00 am. All help is appreciated.
Code:
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
//Button button = (Button)findViewById(R.id.button1);
// button.setOnClickListener(this);
final CheckBox checkBox = (CheckBox) findViewById(R.id.checkBox1);
final CheckBox checkBox2 = (CheckBox) findViewById(R.id.checkBox2);
final Button button = (Button) findViewById(R.id.button1);
button.setOnClickListener(new View.OnClickListener()
{
public void onClick(View v) {
if (checkBox.isChecked()) {
You can open calendar with help of Intent.
Below is code for setting event in Calendar application. you can only open Calendar activity with default Event field filled.
Put above code in your button’s onclick listener.
In addition, you must add these calendar permissions in your manifest.xml: