Adding EditText to Activity : EditText « UI « Android






Adding EditText to Activity

  

<?xml version="1.0" encoding="utf-8"?>
<EditText xmlns:android="http://schemas.android.com/apk/res/android"
  android:id="@+id/field"
  android:layout_width="fill_parent" 
  android:layout_height="fill_parent"
  android:singleLine="false"
  />
  
package app.test;

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

public class Test extends Activity {
  @Override
  public void onCreate(Bundle icicle) {
    super.onCreate(icicle);
    setContentView(R.layout.main);
    
    EditText fld=(EditText)findViewById(R.id.field);
    fld.setText("java2s.com");
  }
}

   
    
  








Related examples in the same category

1.Use EditText to accept user input
2.Parse Uri from EditText control
3.Get text from EditText
4.Create an EditText widget and add the watcher
5.Listen EditText event
6.EditText focus event listener
7.Change color and size for EditText
8.Get value from EditText
9.Note Editor
10.Create Edit Text