MainActivity如下:

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描述:
* simeji使用示例
*
* 注意事项:
* 1 在配置文件中添加
* <action android:name="com.adamrocker.android.simeji.ACTION_INTERCEPT" />
* <category android:name="com.adamrocker.android.simeji.REPLACE" />
* <category android:name="android.intent.category.DEFAULT" />
* 2 此处的REPLACE_KEY的设值.不可随意更改.
*
* 官方文档:
* 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 newContent;
@Override
protected 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("开始调用文字替换");
rawContent=intent.getStringExtra(REPLACE_KEY);
System.out.println("rawContent="+rawContent);
} else {
System.out.println("没有调用到文字替换");
} } private class OnClickListenerImpl implements OnClickListener {
@Override
public void onClick(View v) {
Intent data = new Intent();
newContent="hello everybody";
data.putExtra(REPLACE_KEY, newContent);
setResult(RESULT_OK, data);
finish();
} } }

main.xml如下:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
> <Button
android:id="@+id/button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="replace text"
android:layout_centerInParent="true"
/> </RelativeLayout>

AndroidManifest.xml如下:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="cn.testsimeji"
android:versionCode="1"
android:versionName="1.0" > <uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="8" /> <application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name="cn.testsimeji.MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" /> <action android:name="com.adamrocker.android.simeji.ACTION_INTERCEPT" />
<category android:name="com.adamrocker.android.simeji.REPLACE" />
<category android:name="android.intent.category.DEFAULT" /> </intent-filter>
</activity> </application> </manifest>

Android日语输入法Simeji使用示例的更多相关文章

  1. Android Studio使用百度地图示例BaiduMapsApiASDemo

    Android Studio使用百度地图示例BaiduMapsApiASDemo 用自己AVD下的debug.keystore替换掉项目中的debug.keystore 生成自己的签名 同样的方法生成 ...

  2. paip.android 手机输入法制造大法

    paip.android 手机输入法制造大法 作者Attilax ,  EMAIL:1466519819@qq.com 来源:attilax的专栏 地址:http://blog.csdn.net/at ...

  3. IME日语输入法的快捷键

    <1>小小技巧 alt+shift可以在中,英,日之间切换 ALT+~可以在假名和英文之间切换 ctrl+CAPSLOCK 和 alt+CAPSLOCK可以在平假名和片假名之间切换 敲完字 ...

  4. 【转】关于android的输入法弹出来 覆盖输入框的有关问题

    今天发现一个问题,在录入信息页面.信息不多,但是输入法弹起后,内容已经超出页面,无滚动条,很不方便. 解决办法:在配置文件中,页面对应的Activity中添加 <activity android ...

  5. android自定义倒计时控件示例

    这篇文章主要介绍了Android秒杀倒计时自定义TextView示例,大家参考使用吧 自定义TextView控件TimeTextView代码: 复制代码 代码如下: import android.co ...

  6. Android Google AdMob 广告接入示例

    Android Google AdMob 广告接入示例 [TOC] 首先请大家放心,虽然 Google搜索等服务被qiang了,但是 广告服务国内还是可以用的,真是普天同庆啊~~~噗! 其实这篇文章也 ...

  7. IDEA插件(Android Studio插件)开发示例代码及bug解决

    IDEA插件(Android Studio插件)开发示例代码及bug解决 代码在actionPerformed方法中,有个AnActionEvent e 插件开发就是要求我们复写上述的这个方法即可,在 ...

  8. Android Studio原生库创建示例

    [时间:2017-07] [状态:Open] [关键词:Android,Android Studio,gradle,native,c,c++,cmake,原生开发] 0 引言 最近在工作中遇到了升级A ...

  9. Linux Mint---fcitx中文,日语输入法

    安装中文输入法,我这边选了小企鹅,先前用过scim,稍微比较了下,效果还是这个好 安装可一步即可搞定 apt-get install fcitx fcitx-table-wubi-large fcit ...

随机推荐

  1. 由查找session IP 展开---函数、触发器、包

    由查找session IP 展开---函数.触发器.包 一.userenv函数.sys_context函数 --查看当前client会话的session IP信息 SQL>select sys_ ...

  2. nodejs 批处理运行 app.js

    1.直接执行run.bat文件         以下的内容为批处理文件run.bat中的内容,批处理命令中NODE_PATH为Node.js的安装路径. 使用express 生成的项目.app.js为 ...

  3. 状态模式----C++实现

    状态模式 定义: 允许一个对象在其内部状态改变时改变它的行为.对象看起来似乎修改了它的类. 实用性: 1. 一个对象的行为取决于它的状态,并且它必须在运行时刻根据状态改变它的行为. 2. 一个操作中含 ...

  4. mysql的“Got error 28 from storage engine”错误

    磁盘临时空间不够导致.解决办法:清空/tmp目录,或者修改my.cnf中的tmpdir参数,指向具有足够空间目录

  5. [跟我学spring][Bean的作用域]

    Bean的作用域 什么是作用域呢?即“scope”,在面向对象程序设计中一般指对象或变量之间的可见范围.而在Spring容器中是指其创建的Bean对象相对于其他Bean对象的请求可见范围. Sprin ...

  6. JavaScript ----------------- 原型式继承

    思想:借助原型可以基于已有的对象创建新对象,同时还不必因此创建自定义类型.为了达到这个目的,看看下面的实现方式 function object(o){ function F(){ } F.protot ...

  7. jquery怎么获取URL的参数

    function request(paras) {                var url = location.href;                var paraString = ur ...

  8. ckplayer,超酷网页播放器,用于集成在网站中的播放器

    自己在工作中做了一个教学网站,点击左边课程,右边播放视频,经过源代码分析,用的就是这个播放器 网址:http://www.ckplayer.com/ 具体使用播放器网站上说的比较明白 div id=& ...

  9. CSS 设计彻底研究(四)盒子的浮动与定位

    第四章 盒子的浮动与定位 本章的重点和难点是深刻地理解”浮动“和”定位“这两个重要的性质,对于复杂页面的排版至关重要. 4.1 盒子的浮动 在标准流中,一个块级元素在水平方向会自动伸张,直到包含它的元 ...

  10. hdu2037 经典贪心入门

    今年暑假不AC Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Sub ...