package name: selva.text
project name: Textview
Android version: 1.5 (support 1.5 and above versions)
main.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#00FF00"
android:text="This is TextView" />
<View
android:layout_width="fill_parent"
android:layout_height="1dip"
android:background="#FF4500"/>
<TextView
android:id="@+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="This is Large Text"
android:textColor="#FFD700"
android:textAppearance="?android:attr/textAppearanceLarge" />
<View
android:layout_width="fill_parent"
android:layout_height="1dip"
android:background="#FF4500"/>
<TextView
android:id="@+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="This is Medium Text"
android:textColor="#8B0000"
android:textAppearance="?android:attr/textAppearanceMedium" />
<View
android:layout_width="fill_parent"
android:layout_height="1dip"
android:background="#FF4500"/>
<TextView
android:id="@+id/textView4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="This is Small Text"
android:textColor="#ffffff"
android:textAppearance="?android:attr/textAppearanceSmall" />
<View
android:layout_width="fill_parent"
android:layout_height="1dip"
android:background="#FF4500"/>
<Button
android:id="@+id/button1"
android:layout_width="106dp"
android:layout_height="wrap_content"
android:text="View number" />
</
LinearLayout>
TextviewActivity.java
package selva.text;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
public class TextviewActivity extends Activity
{
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
final TextView textview=(TextView) findViewById(R.id.textView1);
final TextView ltextview=(TextView) findViewById(R.id.textView2);
final TextView mtextview=(TextView) findViewById(R.id.textView3);
final TextView stextview=(TextView) findViewById(R.id.textView4);
Button viewno=(Button) findViewById(R.id.button2);
viewno.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
int i,i1,i2,i3;
i=111;
String st=String.valueOf(i);
textview.setText(st);
i1=222;
String st1=String.valueOf(i1);
ltextview.setText(st1);
i2=333;
String st2=String.valueOf(i2);
mtextview.setText(st2);
i3=444;
String st3=String.valueOf(i3);
stextview.setText(st3);
}
});
}
}
OUTPUT:
how can i get input fron edittext and show it to textview and than get another one from same edittext and show it to new line in same textview .sorry im new at asking questions here
ReplyDeleteExcellent…Amazing…. I’m satisfied to find so many helpful information here within the put up,for latest php jobs in near me. we want work out extra strategies in this regard, thanks for sharing.
ReplyDeleteThe game industry is growing, especially among small, independent development companies. If you're looking for Game Development Companies , let's take a glimpse at some top game development.
ReplyDelete