Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/382.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 在android应用程序代码中实现验证码_Java_Android - Fatal编程技术网

Java 在android应用程序代码中实现验证码

Java 在android应用程序代码中实现验证码,java,android,Java,Android,我必须在我的android应用程序代码中实现Captcha,但在java类中有很多错误 我举了一个例子: 验证码高度字段在该行中不可见: this.height 以下文件中的类型TextCaptcha未定义方法TextCaptcha(int,int,int,TextCaptcha.TextOptions): public TextCaptcha(int wordLength, TextOptions opt){ TextCaptcha(0, 0, wordLength, opt);

我必须在我的android应用程序代码中实现Captcha,但在java类中有很多错误

我举了一个例子:

验证码高度字段在该行中不可见

this.height
以下文件中的类型TextCaptcha未定义方法TextCaptcha(int,int,int,TextCaptcha.TextOptions):

public TextCaptcha(int wordLength, TextOptions opt){
    TextCaptcha(0, 0, wordLength, opt);
}
im.setLayoutParams(new LinearLayout.LayoutParams(c.width *2, c.height *2));
Captcha c = new MathCaptcha(300, 100, MathOptions.PLUS_MINUS_MULTIPLY); 
字段Captcha.width在以下位置不可见

public TextCaptcha(int wordLength, TextOptions opt){
    TextCaptcha(0, 0, wordLength, opt);
}
im.setLayoutParams(new LinearLayout.LayoutParams(c.width *2, c.height *2));
Captcha c = new MathCaptcha(300, 100, MathOptions.PLUS_MINUS_MULTIPLY); 
构造函数MathCaptcha(int,int,MathCaptcha.MathOptions)在以下位置未定义

public TextCaptcha(int wordLength, TextOptions opt){
    TextCaptcha(0, 0, wordLength, opt);
}
im.setLayoutParams(new LinearLayout.LayoutParams(c.width *2, c.height *2));
Captcha c = new MathCaptcha(300, 100, MathOptions.PLUS_MINUS_MULTIPLY); 

请任何人在此帮助我或指定一个真正有效的脚本?

嘿@Hamamelis当您将项目导入eclipse时,您应该执行以下操作,在相应的类中更改以下代码

this.setHeight(height);
那么在Mathcaptcha课上

(c.getWidth() *2, c.getHeight() *2)
在CaptchatestActivity中,您必须做的最后一件事是将方法名称从

TextCaptcha(0, 0, wordLength, opt);


并使该方法的返回类型为void

“我必须在我的android应用程序代码中实现验证码”——为什么?验证码用于网站,以帮助防止自动攻击。在android中不可能实现验证码吗?安卓应用程序对自动攻击免疫?“安卓应用程序对自动攻击免疫?”——我不知道有人可以通过网络在安卓GUI上模拟输入的任何攻击向量。如果你知道一些,请提供链接。@Hamamelis我也不知道,我认为在Android中没有这样做的方法。在您的网站上需要验证码,任何其他用户都可以运行bot在一秒钟内完成类似1个Lacs+注册的活动。要解决这个问题,您需要在那里使用Captcha