Android日语输入法Simeji使用示例
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使用示例的更多相关文章
- Android Studio使用百度地图示例BaiduMapsApiASDemo
Android Studio使用百度地图示例BaiduMapsApiASDemo 用自己AVD下的debug.keystore替换掉项目中的debug.keystore 生成自己的签名 同样的方法生成 ...
- paip.android 手机输入法制造大法
paip.android 手机输入法制造大法 作者Attilax , EMAIL:1466519819@qq.com 来源:attilax的专栏 地址:http://blog.csdn.net/at ...
- IME日语输入法的快捷键
<1>小小技巧 alt+shift可以在中,英,日之间切换 ALT+~可以在假名和英文之间切换 ctrl+CAPSLOCK 和 alt+CAPSLOCK可以在平假名和片假名之间切换 敲完字 ...
- 【转】关于android的输入法弹出来 覆盖输入框的有关问题
今天发现一个问题,在录入信息页面.信息不多,但是输入法弹起后,内容已经超出页面,无滚动条,很不方便. 解决办法:在配置文件中,页面对应的Activity中添加 <activity android ...
- android自定义倒计时控件示例
这篇文章主要介绍了Android秒杀倒计时自定义TextView示例,大家参考使用吧 自定义TextView控件TimeTextView代码: 复制代码 代码如下: import android.co ...
- Android Google AdMob 广告接入示例
Android Google AdMob 广告接入示例 [TOC] 首先请大家放心,虽然 Google搜索等服务被qiang了,但是 广告服务国内还是可以用的,真是普天同庆啊~~~噗! 其实这篇文章也 ...
- IDEA插件(Android Studio插件)开发示例代码及bug解决
IDEA插件(Android Studio插件)开发示例代码及bug解决 代码在actionPerformed方法中,有个AnActionEvent e 插件开发就是要求我们复写上述的这个方法即可,在 ...
- Android Studio原生库创建示例
[时间:2017-07] [状态:Open] [关键词:Android,Android Studio,gradle,native,c,c++,cmake,原生开发] 0 引言 最近在工作中遇到了升级A ...
- Linux Mint---fcitx中文,日语输入法
安装中文输入法,我这边选了小企鹅,先前用过scim,稍微比较了下,效果还是这个好 安装可一步即可搞定 apt-get install fcitx fcitx-table-wubi-large fcit ...
随机推荐
- DirectX 初始化DirectX(第一方式)
上一章我们学会了如何C++Win32项目中搭建DirectX开发环境, 那么下面来写代码初始化DirectX吧O(∩_∩)O~. 首先你创建一个Win32程序,点击运行你可以看见一个window窗 ...
- UITextView 输入长度限制
//还可以输入的长度. - (void)textViewDidChange:(UITextView *)textView { UITextRange *markRange = textView.mar ...
- 判断一个int 型整数 是否为回文数
leetcode 上的题目 Determine whether an integer is a palindrome. Do this without extra space. 由于不能使用额外空间, ...
- html5的a标签使用
主要是href和target两个属性 示比例如以下: <a href="" target="_blank">Visit w3school</a ...
- HTML\Script 去除关键字
以下是引用片段: ----- /**/ /// <summary> /// 去除HTML标记 /// </summary> /// <param name="N ...
- XML读写
private string fileName = HttpContext.Current.Server.MapPath("~/Student.xml"); protected v ...
- baidu地图的一个拾取坐标系统
http://api.map.baidu.com/lbsapi/getpoint/index.html 可以很方便的通过标记取得经纬度坐标 也可以输入经纬度坐标获得地图标记
- oracle导出数据显示出现ora-00109或者LRM-00109出错修改办法
出现这种问题是因为日期格式的问题,调整日期格式后就可以了 改成yyyy-mm-dd的格式就好了
- oracle 经典语句集合
1.一列转多行 方法一: select a.id, substr(','||a.name||',',instr(','||a.name,',',1,b.rn)+1, instr(a.name| ...
- UITextView(文本视图) 学习之初体验
UITextView文本视图相比与UITextField直观的区别就是UITextView可以输入多行文字并且可以滚动显示浏览全文.常见UITextView使用在APP的软件简介.内容详情显示.小说阅 ...