Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/192.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 如何访问doinbackground中的预励磁数据?_Java_Android_Sqlite - Fatal编程技术网

Java 如何访问doinbackground中的预励磁数据?

Java 如何访问doinbackground中的预励磁数据?,java,android,sqlite,Java,Android,Sqlite,在doinbackground线程中,我想在sqlite表中插入该微调器值,我知道我不能在doinbackground中使用ui组件。期待你的帮助。 这是我的预超额价值 try { statement = connect.prepareStatement("exec dbo.getSalesIdtest;"); } catch (SQLException e) { Log.e("Error 1 here: ", e.getMessa

在doinbackground线程中,我想在sqlite表中插入该微调器值,我知道我不能在doinbackground中使用ui组件。期待你的帮助。 这是我的预超额价值

try {
            statement = connect.prepareStatement("exec dbo.getSalesIdtest;");
        } catch (SQLException e) {
            Log.e("Error 1 here: ", e.getMessage());
        }

        try {
            rs = statement.executeQuery();
        } catch (SQLException ex) {
            Log.e("error 2 here: ", ex.getMessage());
        }
        try {
            while(rs.next()) {
                TextView generateData = (TextView) findViewById(R.id.getOrderid);
                pab = rs.getString("CurrentNo");
                generateData.setText(pab);
                Log.e(pab,"Message here is");
              boolean isInserted = orderDB.insertorderData(rs.getString("CurrentNo"));

                if (isInserted == true)
                    Toast.makeText(orderChalan.this, "Data save successfully", Toast.LENGTH_LONG).show();
                else
                    Toast.makeText(orderChalan.this, "Data not Inserted", Toast.LENGTH_LONG).show();
这是我的背景代码

if (con == null) {
                                z = "Check Your Internet Access!";
                            } else {
                                String query = "insert into dbo.slsOrderD(osdSalesID,osdProductID,osdQty)values('joy','" + getRata.getString(1).toString() + "','" + getRata.getString(2).toString() + "');";
                                PreparedStatement preparedStatement = con.prepareStatement(query);
                                preparedStatement.executeUpdate();
                                z = "New client's data added successfully";
                                isSuccess = true;
                            }
                        } catch (Exception ex) {
                            isSuccess = false;
                            z = "Exceptions";
                            Log.e("ERRO", ex.getMessage());
                        }

在insert语句中,我必须从预执行微调器元素访问数据如何解决此问题?

如果您将在onPreExecute()中更新的变量声明为继承的Asynctask版本的类成员,那么您应该能够从doInBackground()访问它们

从我看到的情况来看,您正在OnPreExecute()中将它们声明为局部变量