Wednesday, October 24, 2012

Android IME(Input Method Editor) Example


Android IME(Input Method Editor) Example

Input method Editor(IME) for user able to control the enter text.

1.imeOptionSend and InputType Email
 <EditText 
        android:inputType="text|textEmailAddress"
        android:imeOptions="actionSend"
      />

If you gave input method textEmailAddress based on that keyboard appear and imeOption = “actionsend” in keyboard send button will enabled.

2.imeOptionDone and InputTypeNumber
 <EditText 
        android:inputType="number|numberSigned|numberDecimal"
        android:imeOptions="actionDone"
      />
If you gave input method number|numberSigned|numberDecimal based on that keyboard appear and imeOption = “actionDone” in keyboard Done button will enabled.


Screen Shot




Main.xml

<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
  android:layout_width="fill_parent"
  android:layout_height="fill_parent"
> 
  <TableLayout
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:stretchColumns="1"
    >
    <TableRow> 
      <TextView 
        android:text="No  rules:"
      />
      <EditText
      />
    </TableRow>
    <TableRow> 
      <TextView 
        android:text="Email address:"
      />
      <EditText 
        android:inputType="text|textEmailAddress"
        android:imeOptions="actionSend"
      />
    </TableRow>
    <TableRow> 
      <TextView 
        android:text="Signed decimal number:"
      />
      <EditText 
        android:inputType="number|numberSigned|numberDecimal"
        android:imeOptions="actionDone"
      />
    </TableRow>
    <TableRow> 
      <TextView 
        android:text="Date:"
      />
      <EditText 
        android:inputType="date"
      />
    </TableRow>
    <TableRow> 
      <TextView 
        android:text="Multi-line text:"
      />
      <EditText 
        android:inputType="text|textMultiLine|textAutoCorrect"
        android:minLines="3"
        android:gravity="top"
      />
    </TableRow>
  </TableLayout>
</ScrollView>

Activity Code

package com.madqa;

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

/**
 *
 * @author vijayakumar
 *
 */
public class AndroidMADQAActivity extends Activity  {
     TextView textView = null;
     Activity act;
   
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
          setContentView(R.layout.main);
       
    }
  
}


Check out this may be help you

Related Posts Plugin for WordPress, Blogger...