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. javascript 继承机制设计思想

    作者: 阮一峰 原文链接:http://www.ruanyifeng.com/blog/2011/06/designing_ideas_of_inheritance_mechanism_in_java ...

  2. web文档类型DOCTYPE html很重要

    之前写html或者jsp页面,从来不注意DOCTYPE 的声明,也不太明白DOCTYPE 的作用.直到最近碰到了一个非常奇葩的bug:某一个页面在IE7和8,Chrome,ff等下正常,但是在IE9下 ...

  3. matlab学习

    1.将一个图片嵌入一张图里,去除黑边 clc clear close all I = imread('qiegray.jpg'); I = rgb2gray(I); I = double(I); I1 ...

  4. LDA-线性判别分析(三)

    本来是要调研 Latent Dirichlet Allocation 的那个 LDA 的, 没想到查到很多关于 Linear Discriminant Analysis 这个 LDA 的资料.初步看了 ...

  5. 4. 绘制光谱曲线QGraphicsView类

    一.前言 Qt的QGraphicsView类具有强大的视图功能,与其一起使用的还有QGraphicsScene类和QGraphicsItem类.大体思路就是通过构建场景类,然后向场景对象中增加各种图元 ...

  6. C#基础学习心得(一)

    类的成员 数据成员:字段,常量(const) 函数成员:方法,属性,索引器,构造函数,析构函数,事件 类的声明 实例成员:对象相关性,不同于同一类的其他实例 静态成员:常量,static修饰的字段,方 ...

  7. 【jquery ,ajax,php】加载更多实例

    jquery $(function() { //初始化 getData(0); var index = 1; $("#more").click(function() { getDa ...

  8. jQuery中click()与trigger方法的区别

    click()可以执行单击事件,但是不可传参. $("button").click(function(){ alert("hello."); }); trigg ...

  9. parseInt引发的血案

    今天做了个专题活动,页面头上有个倒计时 专题做完后上线了,没发现有什么问题,结果,运营MM突然和我说:技术哥哥出问题了,360浏览器在秒数从10到09的时候直接变成 00 了! 一看我去真的,该死的3 ...

  10. BackgroundWorker 后台进程控制窗体label、richtextbook内容刷新

    昨天写了一个从文章中提取关键词的程序,写完处理的逻辑后又花了好几个小时在用户友好性上.加了几个progressBar,有显示总进度的.有显示分布进度的..因为程序要跑好几个小时才能执行好,只加个总进度 ...