How to make an android application ?
Step by step instructions to Create an Android App With Android Studio
Stage 1: Install Android Studio
Go to http://developer.android.com/sdk/index.html to download Android Studio.
Utilize the installer to introduce Android Studio following its guidelines.
Stage 2: Open a New Project
2 More Images
Open Android Studio.
Under the "Brisk Start" menu, select "Begin another Android Studio venture."
On the "Make New Project" window that opens, name your task "HelloWorld".
On the off chance that you set, the organization name as desired*.
Note where the undertaking record area is and transform it if wanted.
Snap "Next."
Ensure on that "Telephone and Tablet" is the main box that is checked.
In the event that you are intending to test the application on your telephone, ensure the base SDK is beneath your telephone's working framework level.
Snap "Next."
Select "Clear Activity."
Snap "Next."
Leave the greater part of the Activity name fields as they seem to be.
Snap "Wrap up."
*Note: It is commonplace naming tradition in Android tasks to set the organization name as some type of "example.name.here.com".
Stage 3: Edit the Welcome Message in the Main Activity
Explore to the activity_main.xml tab on the off chance that it isn't as of now open.
Ensure that the Design tab is open on the activity_main.xml show.
Snap and drag the "Welcome, world!" from the upper left corner of the telephone show to the focal point of the screen.
In the task document framework on the left half of the window, open the qualities envelope.
In the qualities organizer, double tap the strings.xml document.
In this document, discover the line "Hi world!".
After the "Welcome world!" message, include "Welcome to my application!"
Explore back to the activity_main.xml tab.
Ensure that your focused content currently peruses "Hi world! Welcome to my application!"
Stage 4: Add a Button to the Main Activity
Explore to the Design tab of the activity_main.xml show.
In the Palette menu to one side of the telephone show, discover Button (under the heading Widgets).
Snap and drag Button to be focused underneath your appreciated message.
Ensure your catch is as yet chosen.
In the Properties menu (on the correct side of the window), look down to discover the field for "content."
Change the content from "New Button" to "Next Page."
Stage 5: Create a Second Activity
At the highest point of the task's document framework tree, right tap on "application."
Explore through to New > Activity > Blank Activity.
Change the name of this action to "SecondActivity".
Snap "Wrap up."
Ensure you are in the Design perspective of activity_second.xml.
Drag the content box in the upper left of the telephone show down to the middle as you did on the Main Activity.
With the content box still chosen, discover the "id" field in the Properties menu on the right, and set it to "text2".
Open strings.xml once more.
Include another line under "Hi world! Welcome to my application!" that peruses "Welcome to the second page!".
Explore back to activity_second.xml.
Select the content box once more.
In the Properties sheet, set the "content" field to "@string/second_page".
Ensure that the content box currently peruses "Welcome to the second page!" and is in the focal point of the screen in the telephone show.
Stage 6: Write the Button's "onClick" Method
Select the MainActivity.java tab along the highest point of the workplace.
2. Include the accompanying lines of code toward the finish of the onCreate strategy:
Catch = (Button) findViewById(R.id.button);
button.setOnClickListener(new View.onClickListener() {
@Override
open void onClick(View v) {
goToSecondActivity();
}
});
3. Add the accompanying strategy to the base of the MainActivity class:
private void goToSecondActivity() {
Purpose plan = new Intent(this, SecondActivity.class);
startActivity(intent);
}
4. Tap the + beside import at the third line of MainActivity.java to extend the import proclamations.
5. Add the accompanying to the finish of the import articulations in the event that they are not as of now there:
import android.content.Intent;
import android.view.View;
import android.widget.TextView;
Stage 7: Test the Application
Tap the green play image from the toolbar at the highest point of the Android Studio window.
At the point when the "Pick Device" exchange apperas (this may take a couple of minutes), select the "Lauch emulator" alternative.
Snap OK.
At the point when the emulator opens (this also could take for a short time), the application will naturally dispatch the application upon the virtual telephone being opened.
Ensure that the majority of your content shows accurately and that the catch takes you to the following page.
Stage 8: Up, Up, and Away!
Well done! You've now finished your first Android application with some essential usefulness. Your completed application ought to have a page welcoming the client and a catch that takes the client to a moment page.
From here you have the careless information you have to go ahead to take in everything to think about Android application improvement.
Learn More @ Android training in Chandigarh
0 comments:
Post a Comment
Note: only a member of this blog may post a comment.