小编Dim*_*ima的帖子

将优惠保存到Google电子钱包

在我的应用中,我需要实施从我的应用到Google电子钱包的保存优惠.我找到了这个教程:Developer Documentation- wallet ,但是当我尝试实现它时,我遇到了一个问题.页面中有代码:

OfferWalletObject wob = OfferWalletObject
        .newBuilder()...
Run Code Online (Sandbox Code Playgroud)

但我的环境说,班级没有这种方法.此页面中没有关于此方法的任何内容:开发人员参考文档

有人可以帮助解决这个问题或者说其他方法来保存Google钱包中的优惠.

android android-pay

38
推荐指数
1
解决办法
687
查看次数

从EditText发送KeyEvent

我试图发送的KeyEventEditText.为此,我使用的InputConnectionWrapper是从方法中取出的onCreateInputConnection():

ZanyInputConnection zic;
@Override
public InputConnection onCreateInputConnection(EditorInfo outAttrs) {
    zic = new ZanyInputConnection(super.onCreateInputConnection(outAttrs),
            true);
    return zic;
}
Run Code Online (Sandbox Code Playgroud)

在里面ZanyInputConnection我写了开启班次的方法:

private class ZanyInputConnection extends InputConnectionWrapper {

    public ZanyInputConnection(InputConnection target, boolean mutable) {
        super(target, mutable);
    }

    public void turnOnShift(){
        long eventTime = SystemClock.uptimeMillis();
        sendKeyEvent(new KeyEvent(eventTime, eventTime,
                KeyEvent.ACTION_DOWN,KeyEvent.KEYCODE_SHIFT_LEFT, 0, 0, KeyCharacterMap.VIRTUAL_KEYBOARD, 0,
                KeyEvent.FLAG_SOFT_KEYBOARD|KeyEvent.FLAG_KEEP_TOUCH_MODE));
         sendKeyEvent(new KeyEvent(eventTime, SystemClock.uptimeMillis(),
                KeyEvent.ACTION_UP, KeyEvent.KEYCODE_SHIFT_LEFT, 0, 0, KeyCharacterMap.VIRTUAL_KEYBOARD, 0,
                KeyEvent.FLAG_SOFT_KEYBOARD|KeyEvent.FLAG_KEEP_TOUCH_MODE));

    }
} 
Run Code Online (Sandbox Code Playgroud)

它调用内部onSelectionChange()方法:

@Override
public void onSelectionChanged(int selStart, int …
Run Code Online (Sandbox Code Playgroud)

android

5
推荐指数
0
解决办法
849
查看次数

Android系统.写入失败:使用过程时EPIPE(断管)

您好我尝试通过Process在我的应用内部安装应用.对于该函数,我创建了此方法.

private void loadAndInstallApk(String string) {
    if(!isRooted()){
        return;
    }
    Uri uri = loadApk(string);
    if(uri == null){
        return;
    }
    Process p = null;
    DataOutputStream outs = null;
    try
    {

        p = Runtime.getRuntime().exec(new String[]{"su", "-c", "system/bin/sh"});
        outs=new DataOutputStream(p.getOutputStream());

        String cmd="pm install -r " + uri.getPath();
        Log.d(TAG, "DATA = cmd = " + cmd);
        outs.writeBytes(cmd + "\n");

        // Close the terminal
        outs.writeBytes("exit\n");
        outs.flush();
            p.waitFor();
            if (p.exitValue() != 255) {
                Log.d(TAG, "DATA succerss " + p.exitValue());
                // Sucess 
            }
            else {
                Log.d(TAG, "DATA Fail …
Run Code Online (Sandbox Code Playgroud)

android file epipe

5
推荐指数
1
解决办法
4764
查看次数

标签 统计

android ×3

android-pay ×1

epipe ×1

file ×1