我正在研究自定义键盘应用程序


这是input.xml软键盘背景颜色的代码: -
@Override
public View onCreateInputView() {
Log.e("onStartInputView ","On StartInput View Called--");
SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this);
String Backgroundcolour = preferences.getString("BackgroundColour","");
Log.e("Brithnesss- -","----"+Backgroundcolour);
if(Backgroundcolour.equalsIgnoreCase("black"))
{
this.mInputView = (KeyboardView) getLayoutInflater().inflate(
R.layout.input, null);
}else
{
this.mInputView = (KeyboardView) getLayoutInflater().inflate(
R.layout.input1, null);
//this.mInputView.setB
}
this.mInputView.setOnKeyboardActionListener(this);
this.mInputView.setKeyboard(this.mQwertyKeyboard);
return this.mInputView;
}
@Override public void onStartInputView(EditorInfo attribute, boolean restarting) {
super.onStartInputView(attribute, restarting);
// Apply the selected keyboard to the input view.
setInputView(onCreateInputView());
}
Run Code Online (Sandbox Code Playgroud)
我没有得到如何设置特定键的背景图像.
我正在开发Android BLE应用程序.
是否有任何在Android中同时连接多个BLE设备(创建多个连接)的过程.在我的应用程序中有多个BLE灯,因此第一个灯成功连接,当我点击连接到第二个第二个灯也连接.但一段时间后,第二盏灯自动断开连接.我必须连接多个灯最多8个.
这就是我在做的事情
private final BluetoothGattCallback mGattCallback = new BluetoothGattCallback()
{
@Override
public void onConnectionStateChange(BluetoothGatt gatt, int status,
int newState)
{
String intentAction;
if (newState == BluetoothProfile.STATE_CONNECTED)
{
intentAction = GattActions.ACTION_GATT_CONNECTED;
broadcastUpdate(intentAction);
Log.i(DSERVICE_TAG, "Connected to GATT server.");
// Attempts to discover services after successful connection.
Log.i(DSERVICE_TAG, "Attempting to start service discovery:"
+ mBluetoothGatt.discoverServices());
readRssi();
}
else if (newState == BluetoothProfile.STATE_DISCONNECTED)
{
intentAction = GattActions.ACTION_GATT_DISCONNECTED;
Log.i(DSERVICE_TAG, "Disconnected from GATT server.");
broadcastUpdate(intentAction);
}
}
public void onReadRemoteRssi(BluetoothGatt gatt, int …Run Code Online (Sandbox Code Playgroud) 我有70MB的视频文件,我想通过原始文件夹播放,但应用程序没有启动如何在android中的资产/原始文件夹中添加此视频文件?
我正在开发自定义键盘应用程序.我需要在KeyboardView类中为键或背景颜色设置不同的主题,并在SoftKeyboard中的onCreateInputView()获取键颜色,扩展InputMethodService类.
但是我没有得到如何根据键码获取特定键,所以我可以改变特定键的颜色或背景.
我正在使用自定义键盘应用程序我需要设置或更改键盘的背景主题或颜色.在我的应用程序中,我们可以选择不同的背景主题和不同颜色的键行.在第一次启动应用程序时它工作正常,但下次自定义键盘显示主题时不会更改.
我正在使用此代码:
public class SoftKeyboard extends InputMethodService
implements KeyboardView.OnKeyboardActionListener {
static final boolean DEBUG = false;
/**
* This boolean indicates the optional example code for performing
* processing of hard keys in addition to regular text generation
* from on-screen interaction. It would be used for input methods that
* perform language translations (such as converting text entered on
* a QWERTY keyboard to Chinese), but may not be used for input methods
* that are primarily intended to …Run Code Online (Sandbox Code Playgroud) 我正在获取响应并解析数据并存储在String现在我要在Edittext中显示我正在获得以下异常.我正在获取响应并在AsyncTask中解析
05-02 10:13:56.797: W/System.err(17935): android.view.ViewRoot$CalledFromWrongThreadException: Only the original thread that created a view hierarchy can touch its views.
05-02 10:13:56.867: W/System.err(17935): at android.view.ViewRoot.checkThread(ViewRoot.java:2812)
05-02 10:13:56.867: W/System.err(17935): at android.view.ViewRoot.invalidateChild(ViewRoot.java:607)
05-02 10:13:56.867: W/System.err(17935): at android.view.ViewRoot.invalidateChildInParent(ViewRoot.java:633)
05-02 10:13:56.867: W/System.err(17935): at android.view.ViewGroup.invalidateChild(ViewGroup.java:2505)
05-02 10:13:56.867: W/System.err(17935): at android.view.View.invalidate(View.java:5115)
05-02 10:13:56.867: W/System.err(17935): at android.widget.TextView.invalidateCursor(TextView.java:3661)
05-02 10:13:56.867: W/System.err(17935): at android.widget.TextView.spanChange(TextView.java:6352)
05-02 10:13:56.867: W/System.err(17935): at android.widget.TextView$ChangeWatcher.onSpanAdded(TextView.java:6477)
05-02 10:13:56.867: W/System.err(17935): at android.text.SpannableStringBuilder.sendSpanAdded(SpannableStringBuilder.java:906)
05-02 10:13:56.867: W/System.err(17935): at android.text.SpannableStringBuilder.setSpan(SpannableStringBuilder.java:611)
05-02 10:13:56.867: W/System.err(17935): at android.text.SpannableStringBuilder.setSpan(SpannableStringBuilder.java:514)
05-02 10:13:56.867: W/System.err(17935): at android.text.Selection.setSelection(Selection.java:74)
05-02 10:13:56.867: …Run Code Online (Sandbox Code Playgroud) 给定JSON字符串:
[
{
"id": "236",
"fbid": "",
"fbpw": "",
"udid": "1400000210033",
"state": "",
"fullname": "",
"house": "",
"office": "",
"mobile": "",
"phone": "",
"email1": "prabhjotkaur3@hotmail.com",
"email2": "",
"email3": "",
"descript": "",
"facebook": "",
"twitter": "",
"gplus": "",
"youtube": "",
"linkedin": "",
"tumblr": "",
"instagram": "",
"lasttime": "2013-05-01 20:30:05"
}
]
Run Code Online (Sandbox Code Playgroud)
我想解析这段代码,但没有得到如何解析.请指教我如何解析这个.
提前致谢!
我想获取在Android应用程序中登录并在Imageview中设置的用户的个人资料图片和用户名
我没有得到如何获取个人资料图片.
谢谢提前