Example of using Android Japanese input method Simeji

Source: Internet
Author: User

Package cn. testsimeji; import android. OS. bundle; import android. view. view; import android. view. view. onClickListener; import android. widget. button; import android. app. activity; import android. content. intent;/*** Demo Description: * simeji usage example ** Note: * 1 add * <action android: name = "com. adamrocker. android. simeji. ACTION_INTERCEPT "/> * <category android: name =" com. adamrocker. android. simeji. REPLACE "/> * <categ Ory android: name = "android. intent. category. DEFAULT "/> * 2 set the REPLACE_KEY here. it cannot be changed at will. ** official documentation: * http://simeji.me/blog/make_mushroom */public class MainActivity extends Activity {private static final String ACTION_INTERCEPT = "com. adamrocker. android. simeji. ACTION_INTERCEPT "; private static final String REPLACE_KEY =" replace_key "; private Button mButton; private String rawContent; private String newCon Tent; @ Overrideprotected void onCreate (Bundle savedInstanceState) {super. onCreate (savedInstanceState); setContentView (R. layout. main); init ();} private void init () {mButton = (Button) findViewById (R. id. button); mButton. setOnClickListener (new OnClickListenerImpl (); Intent intent = this. getIntent (); String action = intent. getAction (); if (action! = Null & ACTION_INTERCEPT.equals (action) {System. out. println ("start to call text replacement"); rawContent = intent. getStringExtra (REPLACE_KEY); System. out. println ("rawContent =" + rawContent);} else {System. out. println ("text replacement not called");} private class OnClickListenerImpl implements OnClickListener {@ Overridepublic void onClick (View v) {Intent data = new Intent (); newContent = "hello everybody"; data. putExtra (REPLACE_KEY, newContent); setResult (RESULT_ OK, data); finish ();}}}

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.