Saturday 26 August 2017

One Activity To another Activity in android app

When we click on button, we should go to another activity. Lets use existing project.

add second activity on button listenerL

clickButton.setOnClickListener(new View.OnClickListener() {
    @Override    public void onClick(View view) {
        //Toast.makeText(getApplicationContext(),"You just clicked button",Toast.LENGTH_LONG).show();        Intent intent = new Intent(MainActivity.this,SecondActivity.class);
        startActivity(intent);
    }
});




Now add second activity:

right click on res folder and create SecondActivity:

New--> Activity--> Empty Activity



When we run code as shown below,




When we click on 'CLICK ME' button, below second activity comes:



No comments:

Post a Comment

Extract error records while inserting into db table using JDBCIO apache beam in java

 I was inserting data into postgres db using apache beam pipeline. it works perfectly with JdbcIO write of apache beam library. But, now, i ...