Android apps LAB MANUAL (1) - Week9 Write an Android application program that displays Hello World using Eclipse Source Code main.xml

Android apps LAB MANUAL (1) - Week9 Write an Android...

This preview shows page 1 - 5 out of 17 pages.

Week9: Write an Android application program that displays Hello World using EclipseSource Code:main.xml<?xmlversion="1.0"encoding="utf-8"?><LinearLayoutxmlns:android=""android:orientation="vertical"android:layout_width="fill_parent"android:layout_height="fill_parent"><TextViewandroid:layout_width="fill_parent"android:layout_height="wrap_content"android:text="Hello World"android:gravity="center_horizontal"android:textSize="25dip"/></LinearLayout>HelloWorld.javapackagehello.test;importandroid.app.Activity;importandroid.os.Bundle;publicclassHelloWorld extendsActivity {/** Called when the activity is first created. */@OverridepublicvoidonCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState);setContentView(R.layout.main);}}Output:
Background image
Week10: Write an Android application that accepts a name from the user and displays the hello name to the user in response as output using EclipseSource Code:main.xml<?xmlversion="1.0"encoding="utf-8"?><LinearLayoutxmlns:android=""android:orientation="vertical"android:gravity="center_horizontal"android:layout_width="fill_parent"android:layout_height="fill_parent"><EditTextandroid:id="@+id/editText1"android:layout_height="75dp"android:hint="User Name"android:layout_width="fill_parent"/><Buttonandroid:layout_height="65dip"android:text="Display"android:id="@+id/button1"android:layout_width="wrap_content"/></LinearLayout>HaiUser.javapackageuser.hello;importandroid.app.Activity;importandroid.os.Bundle;importandroid.view.View;importandroid.widget.Button;importandroid.widget.EditText;importandroid.widget.Toast;publicclassHaiUser extendsActivity {/** Called when the activity is first created. */@OverridepublicvoidonCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState);setContentView(R.layout.main);Button disp=(Button)findViewById(R.id.button1);disp.setOnClickListener(newView.OnClickListener() {publicvoidonClick(View v) {EditText name=(EditText)findViewById(R.id.editText1);String user=name.getText().toString();Toast.makeText(HaiUser.this,"Hello"+user, Toast.LENGTH_SHORT).show();}});}
Background image
}Output:Week11a: Write an Android application to demonstrate Linear Layout example using EclipseSource Code:main.xml:<?xmlversion="1.0"encoding="utf-8"?><LinearLayoutxmlns:android=""android:orientation="vertical"android:layout_width="fill_parent"android:layout_height="fill_parent"><TextViewandroid:layout_width="fill_parent"android:layout_height="wrap_content"android:text="Vertical Orientation"android:textSize="30sp"android:gravity="center_horizontal"/>
Background image
<TextViewandroid:layout_width="fill_parent"android:layout_height="wrap_content"android:text="Hai"android:textSize="20sp"android:paddingBottom="10dp"/><TextViewandroid:layout_width="fill_parent"android:layout_height="wrap_content"android:text="Hello"android:textSize="20sp"android:paddingBottom="10dp"/><TextViewandroid:layout_width="fill_parent"android:layout_height="wrap_content"android:text=
Background image
Image of page 5

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture