android start activity from activity code example

Example 1: intent android open activity

Intent intent = new Intent(this, DisplayMessageActivity.class);
        intent.putExtra(key:,value:);
        startActivity(intent);

Example 2: go to activity android

//going to another activity while ending the 
//previous one so that users cannot go back
btListe = (ImageButton)findViewById(R.id.Button_Liste);
    btListe.setOnClickListener(new OnClickListener()
    {    public void onClick(View v)
        {
            intent = new Intent(main.this, ListViewImage.class);
            startActivity(intent);
            finish();
        }
    });

Tags:

Java Example