日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

android开机调用搜狗输入法

發布時間:2023/12/15 编程问答 37 豆豆
生活随笔 收集整理的這篇文章主要介紹了 android开机调用搜狗输入法 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
最近感覺android系統自帶的 輸入法很不好用, 打字的時候老是點擊錯誤, 于是把android系統自帶的輸入法從系統里直接干掉了(必須破解后),安裝了搜狗輸入法,感覺用搜狗的輸入法輸入文字非常快,中英文,標點符號切換都很快.但是如果手機每次重啟的時候搜狗輸入法啟動的很慢,有時候就是啟動不起來,所以無法輸入文件信息.于是我就寫下了下面的程序,開始自動啟動搜狗輸入法進程:

AndroidManifest.xml:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="sunny.app"
android:versionCode="1"
android:versionName="1.0">
<application android:icon="@drawable/icon" android:label="@string/app_name">
</application>
[i][b] <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>[/b][/i]
</manifest>

BootBroadcastReceiver.java:

package sunny.app;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
public class BootBroadcastReceiver extends BroadcastReceiver {
static final String ACTION = "android.intent.action.BOOT_COMPLETED";
int ActionFlag = 0;
public void onReceive(Context context, Intent intent) {
if (intent.getAction().equals(ACTION)) {
Intent helloIntent = new Intent(context,StartSouGou.class);
helloIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startService(helloIntent);
ActionFlag = -1;
}
}

}

StartSouGou.java:

package sunny.app;
import java.io.IOException;

import android.app.Service;
import android.content.Intent;
import android.os.IBinder;

public class StartSouGou extends Service {
public IBinder onBind(Intent arg0) {
return null;
}
public int onStartCommand(Intent intent, int flags, int startId) {
Runtime runtime = Runtime.getRuntime();
try {
runtime.exec("com.sohu.inputmethod.sogou");
} catch (IOException e) {
}
return super.START_NOT_STICKY;
}
public void onDestroy() {
super.onDestroy();
}
}

com.sohu.inputmethod.sogou 為搜狗的進程

總結

以上是生活随笔為你收集整理的android开机调用搜狗输入法的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。