<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    >
<TextView

android:id="@+id/textView1"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:text="@string/hello"
    />
<EditText
android:id="@+id/editText1"
android:layout_height="wrap_content"
    android:text="PowenKo.com"
android:layout_width="fill_parent">
    <requestFocus></requestFocus>
</EditText>
</LinearLayout>

 

package com.powenko.Tutorial_UI_EditText;

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

public class Tutorial_UI_EditTextActivity extends Activity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        TextView t_textView_title = (TextView)findViewById(R.id.textView1);
        t_textView_title.setText("Food");

        EditText t_EditText = (EditText)findViewById(R.id.editText1);
        String t1=t_EditText.getText().toString();

        t_textView_title.setText(t1);
        t_EditText.setText("San Francisco");

    }
}

sample code:

Tutorial_UI_EditText

By admin-powenko

Dr. Powen Ko is a teacher and CEO on LoopTek LLC, and like to teaching. if you need to class, please let PowenKo know, he will love to service and sharing. LoopTek web site is www.looptek.com

Leave a Reply