Android日语输入法Simeji使用示例
来源:互联网 发布:如何在淘宝购物省钱 编辑:程序博客网 时间:2024/04/29 13:55
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;@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("开始调用文字替换"); rawContent=intent.getStringExtra(REPLACE_KEY); System.out.println("rawContent="+rawContent);} else { System.out.println("没有调用到文字替换");}}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();}}}
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使用示例
- 日语输入法使用技巧!
- 日语输入法使用小结
- 如何使用日语输入法
- 日语输入法使用
- 日语输入法
- 日语输入法
- 日语输入法无法使用的解决方法
- 日语输入法快捷键
- 日语输入法使用方法
- 日语输入法一点技巧
- 添加日语输入法
- 日语输入法下载
- 微软日语输入法使用方法
- 日语输入法使用方法
- 日语输入法备忘录
- 日语输入法汇总
- fcitx日语输入法添加
- jump table
- activex控件开发时如何用ie8进行调试
- hibernate连接查询
- Xcodebuild 命令行编译笔记
- 用CAB发布OCX的简单办法
- Android日语输入法Simeji使用示例
- 编写最简单的 iPhone 界面切换应用
- js 如果js执行不出来,很可能是代码有问题
- 9大“抠门”富豪揭密
- google的galaxy nexus没有MENU菜单键的原因,android4.0以上google不推荐使用菜单
- 这是第一篇文章吧,发一篇关于Spring Security 3 权限管理数据库设计的疑惑
- AD中用户帐户属性userAccountControl
- ASIHTTPRequest开源类项目导入问题及解决方
- Kconfig和Makefile相关基本语法