0

I'm developing an APP for a schoolwork. When I launch my app, I configured 4 buttons, one of them is a calendar. What I want is when I click on Calendar, this open the Google calendar; or if I don't have installed it, take you to Google Play.

The other buttons are activities in the same application, but these are solved.

The main activity:

public class MainActivity extends Activity {

    @Override
    protected void onCreate (Bundle savedInstanceState){
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        entrarboton();
    }

    private void entrarboton() {
        ImageButton accionentrar = (ImageButton) findViewById(R.id.imageButton0);
        accionentrar.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                startActivity(new Intent(MainActivity.this,Calendari.class));
            }
        });
        ImageButton accionentrar2 = (ImageButton)findViewById(R.id.imageButton3);
        accionentrar2.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                startActivity(new Intent(MainActivity.this,Notes.class));

            }
        });
        ImageButton accionentrar3 = (ImageButton)findViewById(R.id.imageButton2);
        accionentrar3.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                startActivity(new Intent(MainActivity.this,Apunts.class));
            }
        });
        ImageButton accionentrar4 = (ImageButton)findViewById(R.id.imageButton4);
        accionentrar4.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                startActivity(new Intent(MainActivity.this,Altres.class));
            }
        });
    }
}
Michael Yaworski
  • 12,398
  • 17
  • 59
  • 91
pkssssss
  • 3
  • 3
  • Did you search for an answer before asking? These are similar; http://stackoverflow.com/questions/3872063/android-launch-an-application-from-another-application and http://stackoverflow.com/questions/2780102/open-another-application-from-your-own-intent – Patrick Jan 04 '14 at 15:22
  • Yes @Patrick but I fail to solve :( – pkssssss Jan 04 '14 at 15:41

0 Answers0