Develop Your First Android Application Using Intent

Hello friend, and welcome back. Today in this tutorial I am gonna show you how can you create your first android application with multiple page. At first you will have to download the mentioned software.
Requirements:-
2. Java
Step 1. Start a new android studio new project.
Step 2. Add your application name whatever you like.
Step 3. Choose Empty activity and click next.
Step 4: Leave the setting as default and click finish.
Step 5: Copy the given code in activity_main.xml.
Step 6: Create a new activity. Choose Empty Activity.
Step 7: Name the Activity as Second and then copy the given code in activity_second.xml.
Step 7: Copy the given code in MainActivity.
package simant.newapp; import android.content.Intent; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.widget.Button; public class MainActivity extends AppCompatActivity { Button button; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); button = (Button) findViewById(R.id.But); button.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(MainActivity.this,Second.class); startActivity(intent); } }); } } |
Step 8: Now built your first android project and installed it in your device.
Step 9: Install and run your app. It will display like this.
Step 10. Click (Click Me) button and it will take you to another page.
!!Hope you like our post. Please don't forget to share and comment in our post!!

2 comments:
Post a Comment