Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 1

=================================================================

Ex No: 2 Name :
Concatenation of Two String using Edit Test
Date : Roll No :
=================================================================
package com.example.concatenation;

import android.app.Activity;
import android.os.Bundle;
import android.widget.TextView;

public class MainActivity extends Activity


{
String string_1,string_2,string_3;
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
string_1= "Welcome";
string_2= "To Android";
string_3= string_1+string_2;
TextView result= (TextView)findViewById(R.id.textView1);
result.setText(string_3);
}
}

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context="com.example.concatenation.MainActivity" >

<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_marginLeft="57dp"
android:layout_marginTop="104dp"
android:text="TextView" />

</RelativeLayout>

You might also like