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 ...
随机推荐
- View中取设置了Tag的UILabel
UILabel *badge = (UILabel *)[self.view viewWithTag:];
- Binarized Neural Networks_ Training Neural Networks with Weights and Activations Constrained to +1 or −1
转载请注明出处: http://www.cnblogs.com/sysuzyq/p/6248953.html by 少侠阿朱
- High bridge, low bridge(离散化, 前缀和)
High bridge, low bridge Q:There are one high bridge and one low bridge across the river. The river h ...
- fragment的入门DEMO
效果图: 代码如下: 1.main.xml <?xml version="1.0" encoding="utf-8"?> <LinearLay ...
- [汇编学习笔记][第十七章使用BIOS进行键盘输入和磁盘读写
第十七章 使用BIOS进行键盘输入和磁盘读写 17.1 int 9 中断例程对键盘输入的处理 17.2 int 16 读取键盘缓存区 mov ah,0 int 16h 结果:(ah)=扫描码,(al) ...
- HttpURLConnection 下载代码
private int downloadFile(final String apkurl, final String apkname) { Log.e(LOGTAG, "downloadAp ...
- QTestlib Manual翻译
Trolltech公司提供的QTestlib框架,是一种针对基于QT编写的程序或库的单元测试工具.QTestLib提供了单元测试框架的基本功能,并提供了针对GUI测试的扩展功能. 目录: QtestL ...
- (原+译)win7远程连接ubuntu16.04
转载请注明出处: http://www.cnblogs.com/darkknightzh/p/5711214.html 原始网址: http://ubuntuhandbook.org/index.ph ...
- LinearLayout的一些注意事项
1.orientation的默认值为horizontal,即从左向右排列.由于一般从上向下排列,所以必须指定orientation属性. 2.layout_gravity与gravity的区别: (1 ...
- Django学习之路
Django Website Collect django packages http://djangopackages.com/ django project http://code.djangop ...