小编k-p*_*rog的帖子

Jsoup POST:定义选定的选项以返回HTML?

我正在尝试为包含选项列表的页面生成HTML帖子.有一个下拉列表,用户选择一个项目,然后单击一个生成按钮.根据所选的选项,它会返回各种结果.我之前和之后对HTML进行了比较,可以看到如下差异:

之前

<option value="Option1">Option 1</option>
<option value="Option2">Option 2</option>
<option value="Option3">Option 3</option>
Run Code Online (Sandbox Code Playgroud)

<option value="Option1">Option 1</option>
<option selected="selected" value="Option2">Option 2</option>
<option value="Option3">Option 3</option>
Run Code Online (Sandbox Code Playgroud)

我无法弄清楚jsoup文档生成的语法.到目前为止,我有这个,但它只是不断返回原始HTML,没有结果:

doc = Jsoup.connect("MYurl...")
.timeout(5000)
.userAgent("Mozilla/5.0 (Windows; U; WindowsNT 5.1; en-US; rv1.8.1.6) Gecko/20070725 Firefox/2.0.0.6")
.cookie("auth", "token")
.data("selected", "Option2")
.post();
Run Code Online (Sandbox Code Playgroud)

html java android jsoup

2
推荐指数
1
解决办法
4123
查看次数

从asynctask传递上下文?

好的,所以我有一个运行asynctask的任务服务类,然后在条件满足时启动通知.在发送方法中有一个空指针异常,其中创建了Intent,上下文具有所有空值.我不认为我正确地从BloodLevelParse asynctask传递上下文?不确定我还能尝试什么.这是班级:

public class TaskService extends IntentService {

    private ArrayList<BloodLevels> BloodLevelList;

    private String bloodLevel;
    private String bloodType;
    private Integer bloodLevelDays;

    private MyProfileActivity myProfileActivity;

    private BloodLevelParse bloodLevelParse;

    public TaskService() {
        super("TaskService");
    }

    @Override
    protected void onHandleIntent(Intent intent) {

        // Pass through the blood type
        Bundle bundle = intent.getExtras();
        bloodType = bundle.getString("currentBloodType2");

        // Only perform check if there is an internet connection
        if (CheckNetwork.isInternetAvailable(TaskService.this)) {

            // Check the current blood level for the given blood type
            new BloodLevelParse(this).execute(bloodType);

        } else {
            Toast.makeText( …
Run Code Online (Sandbox Code Playgroud)

android android-asynctask

-1
推荐指数
1
解决办法
132
查看次数

标签 统计

android ×2

android-asynctask ×1

html ×1

java ×1

jsoup ×1