How to Print "Hello World" on Android

Welcome to a simple tutorial on how to print "Hello World" on an Android device using Java.

Step 1: Create a New Project

  1. Open Android Studio
  2. Select New Project from the menu.
  3. Choose "Empty Activity".
  4. Name your project HelloWorldApp.

Step 2: Add a TextView to the Layout

  1. In the XML layout file, add a TextView at the top.
  2. Set its ID to @+id/hw_textview.
  3. Set its text to Hello World.

Step 3: Write the Code

public class HelloWorldActivity extends AppCompatActivity {

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

        TextView hwTextView = findViewById(R.id.hw_textview);
        hwTextView.setText("Hello World");
    }
}
        

Step 4: Run the Application

Note:

This is a basic example. You can extend this by adding more features such as input handling or animations.

Remember to install the necessary Android SDK and set up your development environment before starting.

Additional Resources

Simple Android App