1 HelloWorld Programs



Algorithm:
Step 1) Create a new Android Studio Project named as HelloWorld

Step 2)Goto Project Structure and open activity_main.xml file

Step 3) Create a Text view in Activity_main.xml file or drag and drop from the palette.

Step 4) Add Text to the attribute is android:text="HelloWorld!" in the TextView Tag in the activity_main.xml file.

Step 5) Run the application from the menu bar select Run and Click on Run App option. Program:
activity_main.xml

  <?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"xmlns:app="http://schema s.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".MainActivity">

<TextView android:layout_width="wrap_content" android:layout_height="wrap_content"

android:text="Hello World!"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintRight_toRightOf="parent" app:layout_constraintTop_toTopOf="parent" >
</TextView>

</android.support.constraint.ConstraintLayout>

MainActivity.java

package com.example.helloworld;

import android.support.v7.app.AppCompatActivity; import android.os.Bundle;
public class MainActivity extends AppCompatActivity { @Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); setContentView(R.layout.activity_main);
}
}



OUTPUT:










Comments

Popular posts from this blog

20 Simple Content Provider Example

14 Popup Menu

17 Simple Notification Program