Android 3.0的使用物理键盘设置 [英] Android 3.0 Use Physical Keyboard Setting

查看:255
本文介绍了Android 3.0的使用物理键盘设置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

背景:

我最近购买了摩托罗拉XOOM平板电脑与桌面的码头和蓝牙键盘配件一起。

I recently purchased a Motorola XOOM Tablet along with the Desktop Dock and Bluetooth Keyboard accessories.

码头和键盘工作的伟大,但是当我把平板电脑在码头移到不在办公桌旁,键盘仍然与设备配对,我必须手动更改设置使用软键盘。这同样适用于当我设置回被告席上,我需要手动切换回来。这不是一个的巨大的问题,但是这将是很好不要去想它。

The dock and keyboard work great, but when I take the tablet off the dock to move away from my desk, the keyboard still remains paired with the device and I have to manually change the settings to use the soft keyboard. The same goes for when I set it back on the dock, I need to manually switch it back. It's not a huge problem, but it would be nice not to have to think about it.

于是,我尝试下载从连接或从动力源,不过暂时行之有效断开时,简单地切换蓝牙和关闭市场的应用程序,但期后后台服务会死,成为无用我手动重启,直到那。

So I tried downloading an app from the market that simply toggled Bluetooth on and off when connected or disconnected from a power source, which worked well for a while, but the background service would die after period and become useless until I manually restarted that.

的一点是:我想写我的平板电脑一个小应用程序/服务,将认识的时候就已经停靠/取消固定和切换使用物理键盘设置相应

TO THE POINT: I'm trying to write a little app/service for my tablet that will recognize when it has been docked/undocked and switch the "Use Physical Keyboard" setting accordingly.

我已经开始用BroadcastReciever认识到码头州:

I have started with a BroadcastReciever to recognize the Dock State:


public class DockBroadcastReciever extends BroadcastReceiver {

    private final String DOCK_STATE_LABEL = "android.intent.extra.DOCK_STATE";

    @Override
    public void onReceive(Context context, Intent intent) {
        Bundle extras = intent.getExtras();
        String message = (extras.getInt(DOCK_STATE_LABEL) == Intent.EXTRA_DOCK_STATE_UNDOCKED) ? "Undocked" : "Docked";

        Toast toast = Toast.makeText(context, message, Toast.LENGTH_LONG);
        toast.show();
    }
}

但我有麻烦搞清楚事件被触发后更新设置的最佳途径。我使用的 InputMethodManager 的周围的一些例子戳,但所有的方法似乎需要一个特定的的EditText 的或其他一些输入要绑定到。

But I'm having trouble figuring out the best way to update the setting after the event is fired. I've poked around some examples using InputMethodManager, but all the methods seem to need a specific EditText or some other input to bind to.

此外,我似乎无法找到重新presents相应的常量,任何地方设置的文档,但图形,它坐落在这里:的 http://i.stack.imgur.com/esFaw.png

Furthermore, I can't seem to find a corresponding constant that represents that setting anywhere in the docs, but graphically, it is located here: http://i.stack.imgur.com/esFaw.png

谁能帮我这个?

我想为那里是用于更改设置一个解决方案,但我愿意接受其他的想法。

I would like for there to be a solution for changing the setting, but I am open to other ideas as well.

推荐答案

我有一个应用程序,并类似的事情。它可以根据电源切换WiFi和蓝牙。

I have an app that does something similar. It can toggle wifi and bluetooth based on power.

您需要注册一些这方面的东西在AndroidManifest.xml文件。

You'll need to register some of this stuff in the AndroidManifest.xml file.

的http:// code。 google.com/p/futonic-wifioncall/source/browse/AndroidManifest.xml

项目的开源网站: HTTP://$c$c.google。 COM / p / futonic-wifioncall /

这是不是解决办法,但希望会给你试图完成什么的指导。

This isn't the solution but hopefully will give guidance on what you're trying to accomplish.

这篇关于Android 3.0的使用物理键盘设置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆