如何使用Java打开和关闭虚拟键盘

时间:2017-12-14 07:37:46

标签: java windows virtual-keyboard

我从这里尝试了所有答案:

open the Windows virtual keyboard in a Java program

我执行import java.io.IOException; public class ShowVirtualKeyboard{ public static void main(String argv[]) throws IOException { String sysroot = System.getenv("SystemRoot"); Process proc = Runtime.getRuntime().exec(sysroot + "/system32/osk.exe"); } } 并且我无法按照建议关闭它,我需要在一些过程后关闭它。

我试过了:

Cannot run program "C://Windows/system32/osk.exe": CreateProcess error=740, The requested operation requires elevation

我收到了错误

String path = "asset:///splash_video.mp4";
    Uri uri = Uri.parse(path);
    player = ExoPlayerFactory.newSimpleInstance(new DefaultRenderersFactory(this), new DefaultTrackSelector(), new DefaultLoadControl());
    DataSource.Factory factory = new DefaultHttpDataSourceFactory(Util.getUserAgent(this, getPackageName()));
    simpleExoPlayerView.setPlayer(player);
    ExtractorMediaSource extractorMediaSource = new ExtractorMediaSource(uri, factory, new DefaultExtractorsFactory(), new Handler(), null);
    player.prepare(extractorMediaSource);
    player.setPlayWhenReady(true);

0 个答案:

没有答案