小编Sor*_*ecu的帖子

dispatchKeyEvent调用方法两次

我在我的活动中实现了dispatchKeyEvent来监听被按下的Enter键.问题是,当我点击回车时,它会调用我的方法两次?我怎样才能解决这个问题 ?谢谢,祝你有愉快的一天!

@Override
public boolean dispatchKeyEvent(KeyEvent e) {
if (e.getKeyCode() == KeyEvent.KEYCODE_ENTER) {

              enter();
        return true;
    }
    return super.dispatchKeyEvent(e);
};
Run Code Online (Sandbox Code Playgroud)

java android

9
推荐指数
1
解决办法
5608
查看次数

使用JSoup登录Linkedin

我需要使用Jsoup登录Linkedin,最好是.

这是我用来登录其他网站但它不适用于Linkedin.

Connection.Response res = Jsoup
    .connect("https://www.linkedin.com/uas/login?goback=&trk=hb_signin")
    .data("session_key", mail, "session_password", password)
    .method(Connection.Method.POST)
    .timeout(60000).

// Also tried "https://www.linkedin.com/uas/login-submit"

Map<String, String> loginCookies = res.cookies();
    //Checking a profile to see if it was succesful or if it returns the login page.    
Document currentPage = Jsoup.connect(someProfileLink).cookies(loginCookies).timeout(10000).
System.out.println("" + currentPage.text());
Run Code Online (Sandbox Code Playgroud)

我究竟做错了什么?

我需要能够通过使用网络爬虫来获取用户配置文件,但无论我尝试什么,我都无法获得登录cookie.

java web-crawler linkedin jsoup

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

标签 统计

java ×2

android ×1

jsoup ×1

linkedin ×1

web-crawler ×1