当我运行应用程序logcat时,在register.java文件中给我3个错误,有人知道可能出了什么问题吗?

当我运行应用程序logcat时,在register.java文件中给我3个错误,有人知道可能出了什么问题吗?,java,android,database-connection,Java,Android,Database Connection,//Register.java代码和错误在第101,91,73行 package com.panos.mysqltest; import java.util.ArrayList; import java.util.List; import org.apache.http.NameValuePair; import org.apache.http.message.BasicNameValuePair; import org.json.JSONExcepti

//Register.java代码和错误在第101,91,73行

    package com.panos.mysqltest;

   import java.util.ArrayList;
   import java.util.List;

   import org.apache.http.NameValuePair;
   import org.apache.http.message.BasicNameValuePair;
   import org.json.JSONException;
   import org.json.JSONObject;

   import android.app.Activity;
   import android.app.ProgressDialog;
   import android.os.AsyncTask;
   import android.os.Bundle;
   import android.util.Log;
   import android.view.View;
   import android.view.View.OnClickListener;
   import android.widget.Button;
   import android.widget.EditText;
   import android.widget.Toast;



   public class Register extends Activity implements OnClickListener{


private EditText user, pass;
private Button  mRegister;

 // Progress Dialog
private ProgressDialog pDialog;

// JSON parser class
JSONParser jsonParser = new JSONParser();

//php login script

//localhost :
//testing on your device
 // put your local ip instead,  on windows, run CMD > ipconfig
 // or in mac's terminal type ifconfig and look for the ip under en0 or en1
//private static final String LOGIN_URL ="http://xxx.xxx.x.x:1234/webservice             /register.php";

//testing on Emulator:
private static final String LOGIN_URL = "http://192.168.10.9:1234/wamp/www/android_connect/register.php";

//testing from a real server:
//private static final String LOGIN_URL = "http://www.yourdomain.com/webservice/register.php";

//ids
private static final String TAG_SUCCESS = "success";
private static final String TAG_MESSAGE = "message";

@Override
protected void onCreate(Bundle savedInstanceState) {
    // TODO Auto-generated method stub
    super.onCreate(savedInstanceState);

    setContentView(R.layout.register);

    user = (EditText)findViewById(R.id.username);
    pass = (EditText)findViewById(R.id.password);

    mRegister = (Button)findViewById(R.id.register1);
    mRegister.setOnClickListener(this);

}

@Override
public void onClick(View v) {
    // TODO Auto-generated method stub

         //LINE73  new CreateUser().execute();      
}


class CreateUser extends AsyncTask<String, String, String> {

     /**
     * Before starting background thread Show Progress Dialog
     * */
    boolean failure = false;

    @Override
    protected void onPreExecute() {
        super.onPreExecute();
        pDialog = new ProgressDialog(Register.this);
        pDialog.setMessage("Creating User...");
        pDialog.setIndeterminate(false);
        pDialog.setCancelable(true);
 //LINE91 pDialog.show();
    }



    @Override
    protected String doInBackground(String... args) {
        // TODO Auto-generated method stub
         // Check for success tag
        int success;
       //LINE101   String username = user.getText().toString();
        String password = pass.getText().toString();
        try {
            // Building Parameters
            List<NameValuePair> params = new ArrayList<NameValuePair>();
            params.add(new BasicNameValuePair("username1",username));
            params.add(new BasicNameValuePair("password1", password));

            Log.d("request!", "starting");

            //Posting user data to script
            JSONObject json = jsonParser.makeHttpRequest(
                   LOGIN_URL, "POST", params);

            // full json response
            Log.d("Login attempt", json.toString());

            // json success element
            success = json.getInt(TAG_SUCCESS);
            if (success == 1) {
                Log.d("User Created!", json.toString());
                finish();
                return json.getString(TAG_MESSAGE);
            }else{
                Log.d("Login Failure!", json.getString(TAG_MESSAGE));
                return json.getString(TAG_MESSAGE);

            }
        } catch (JSONException e) {
            e.printStackTrace();
        }

        return null;

    }
    /**
     * After completing background task Dismiss the progress dialog
     * **/
    protected void onPostExecute(String file_url) {
        // dismiss the dialog once product deleted
        pDialog.dismiss();
        if (file_url != null){
            Toast.makeText(Register.this, file_url, Toast.LENGTH_LONG).show();
        }

    }

}

    }
package com.panos.mysqltest;
导入java.util.ArrayList;
导入java.util.List;
导入org.apache.http.NameValuePair;
导入org.apache.http.message.BasicNameValuePair;
导入org.json.JSONException;
导入org.json.JSONObject;
导入android.app.Activity;
导入android.app.ProgressDialog;
导入android.os.AsyncTask;
导入android.os.Bundle;
导入android.util.Log;
导入android.view.view;
导入android.view.view.OnClickListener;
导入android.widget.Button;
导入android.widget.EditText;
导入android.widget.Toast;
公共类寄存器扩展活动实现OnClickListener{
私人编辑文本用户,通过;
私人按钮注册器;
//进度对话框
私人对话;
//JSON解析器类
JSONParser JSONParser=新的JSONParser();
//php登录脚本
//本地主机:
//在您的设备上进行测试
//将本地ip改为在windows上运行CMD>ipconfig
//或者在mac的终端类型ifconfig中,查找en0或en1下的ip
//私有静态最终字符串登录\u URL=”http://xxx.xxx.x.x:1234/webservice             /register.php”;
//在模拟器上测试:
私有静态最终字符串登录\u URL=”http://192.168.10.9:1234/wamp/www/android_connect/register.php";
//从真实服务器进行测试:
//私有静态最终字符串登录\u URL=”http://www.yourdomain.com/webservice/register.php";
//身份证
私有静态最终字符串标记_SUCCESS=“SUCCESS”;
私有静态最终字符串标记_MESSAGE=“MESSAGE”;
@凌驾
创建时受保护的void(Bundle savedInstanceState){
//TODO自动生成的方法存根
super.onCreate(savedInstanceState);
setContentView(R.layout.register);
user=(EditText)findViewById(R.id.username);
pass=(EditText)findViewById(R.id.password);
mRegister=(按钮)findviewbyd(R.id.register1);
mRegister.setOnClickListener(此);
}
@凌驾
公共void onClick(视图v){
//TODO自动生成的方法存根
//LINE73新建CreateUser().execute();
}
类CreateUser扩展异步任务{
/**
*在启动后台线程显示进度对话框之前
* */
布尔失败=假;
@凌驾
受保护的void onPreExecute(){
super.onPreExecute();
pDialog=新建进度对话框(Register.this);
setMessage(“正在创建用户…”);
pDialog.setUndeterminate(假);
pDialog.setCancelable(真);
//LINE91 pDialog.show();
}
@凌驾
受保护的字符串doInBackground(字符串…args){
//TODO自动生成的方法存根
//检查成功标签
成功;
//LINE101字符串username=user.getText().toString();
字符串密码=pass.getText().toString();
试一试{
//建筑参数
List params=new ArrayList();
添加(新的BasicNameValuePair(“username1”,username));
添加(新的BasicNameValuePair(“password1”,password));
Log.d(“请求!”,“启动”);
//将用户数据发布到脚本
JSONObject json=jsonParser.makeHttpRequest(
登录URL,“POST”,参数);
//完整json响应
Log.d(“登录尝试”,json.toString());
//json成功元素
success=json.getInt(TAG_success);
如果(成功==1){
Log.d(“用户创建的!”,json.toString());
完成();
返回json.getString(TAG_消息);
}否则{
Log.d(“登录失败!”,json.getString(TAG_MESSAGE));
返回json.getString(TAG_消息);
}
}捕获(JSONException e){
e、 printStackTrace();
}
返回null;
}
/**
*完成后台任务后,关闭“进度”对话框
* **/
受保护的void onPostExecute(字符串文件\u url){
//删除产品后关闭对话框
pDialog.disclose();
如果(文件url!=null){
Toast.makeText(Register.this,file_url,Toast.LENGTH_LONG.show();
}
}
}
}
//register.xml文件

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >

<RelativeLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_gravity="center" >

    <TextView
        android:id="@+id/txViewregister"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerHorizontal="true"
        android:layout_marginTop="70dp"
        android:text="@string/textView2" />

    <EditText
        android:id="@+id/username1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerHorizontal="true"
        android:layout_marginTop="90dp"
        android:ems="10"
        android:inputType="textPersonName" >

        <requestFocus />
    </EditText>

    <TextView
        android:id="@+id/TextView01"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerHorizontal="true"
        android:layout_marginTop="140dp"
        android:text="@string/textView1" />

    <EditText
        android:id="@+id/password1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerHorizontal="true"
        android:layout_marginTop="160dp"
        android:ems="10"
        android:inputType="textPassword" />

    <Button
        android:id="@+id/register1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerHorizontal="true"
        android:layout_marginTop="200dp"
        android:text="@string/register1" />

</RelativeLayout>

</LinearLayout>

//最后是错误

     E/AndroidRuntime(2462): FATAL EXCEPTION: AsyncTask #1
     E/AndroidRuntime(2462): java.lang.RuntimeException: An error occured while executing doInBackground() 
     E/AndroidRuntime(2462):    at android.os.AsyncTask$3.done(AsyncTask.java:299)
     E/AndroidRuntime(2462):    at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:352)
     E/AndroidRuntime(2462):    at java.util.concurrent.FutureTask.setException(FutureTask.java:219)
     E/AndroidRuntime(2462):    at java.util.concurrent.FutureTask.run(FutureTask.java:239)
     E/AndroidRuntime(2462):    at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:230)
     E/AndroidRuntime(2462):    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
     E/AndroidRuntime(2462):    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
     E/AndroidRuntime(2462):    at java.lang.Thread.run(Thread.java:856)
     E/AndroidRuntime(2462): Caused by: java.lang.NullPointerException
     E/AndroidRuntime(2462):    at com.panos.mysqltest.Register$CreateUser.doInBackground(Register.java:101)
     E/AndroidRuntime(2462):    at com.panos.mysqltest.Register$CreateUser.doInBackground(Register.java:1)
     E/AndroidRuntime(2462):    at android.os.AsyncTask$2.call(AsyncTask.java:287)
     E/AndroidRuntime(2462):    at java.util.concurrent.FutureTask.run(FutureTask.java:234)
     E/WindowManager(2462): Activity com.panos.mysqltest.Register has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView{b50cc420 V.E..... R.....ID 0,0-456,144} that was originally added here
     E/WindowManager(2462): android.view.WindowLeaked: Activity com.panos.mysqltest.Register has   leaked window com.android.internal.policy.impl.PhoneWindow$DecorView{b50cc420 V.E.....   R.....ID 0,0-456,144} that was originally added here
     E/WindowManager(2462):     at android.view.ViewRootImpl.<init>(ViewRootImpl.java:354)
     E/WindowManager(2462):     at android.view.WindowManagerGlobal.addView(WindowManagerGlobal.java:216)
     E/WindowManager(2462):     at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:69)
     E/WindowManager(2462):     at android.app.Dialog.show(Dialog.java:281)
     E/WindowManager(2462):     at com.panos.mysqltest.Register$CreateUser.onPreExecute(Register.java:91)
     E/WindowManager(2462):     at android.os.AsyncTask.executeOnExecutor(AsyncTask.java:586)
     E/WindowManager(2462):     at android.os.AsyncTask.execute(AsyncTask.java:534)
     E/WindowManager(2462):     at com.panos.mysqltest.Register.onClick(Register.java:73)
     E/WindowManager(2462):     at android.view.View.performClick(View.java:4202)
     E/WindowManager(2462):     at android.view.View$PerformClick.run(View.java:17340)
     E/WindowManager(2462):     at android.os.Handler.handleCallback(Handler.java:725)
     E/WindowManager(2462):     at android.os.Handler.dispatchMessage(Handler.java:92)
     E/WindowManager(2462):     at android.os.Looper.loop(Looper.java:137)
     E/WindowManager(2462):     at android.app.ActivityThread.main(ActivityThread.java:5039)
     E/WindowManager(2462):     at java.lang.reflect.Method.invokeNative(Native Method)
     E/WindowManager(2462):     at java.lang.reflect.Method.invoke(Method.java:511)
     E/WindowManager(2462): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
    E/WindowManager(2462):  at    com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
    E/WindowManager(2462):  at dalvik.system.NativeStart.main(Native Method)
E/AndroidRuntime(2462):致命异常:AsyncTask#1
E/AndroidRuntime(2462):java.lang.RuntimeException:执行doInBackground()时出错
E/AndroidRuntime(2462):位于android.os.AsyncTask$3.done(AsyncTask.java:299)
E/AndroidRuntime(2462):位于java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:352)
E/AndroidRuntime(2462):位于java.util.concurrent.FutureTask.setException(FutureTask.java:219)
E/AndroidRuntime(2462):位于java.util.concurrent.FutureTask.run(FutureTask.java:239)
E/AndroidRuntime(2462):位于android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:230)
E/AndroidRuntime(2462):位于java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
E/AndroidRuntime(2462):位于java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
E/AndroidRuntime(2462):位于java.lang.Thread.run(Thread.java:856)
E/AndroidRuntime(2462):由以下原因引起:java.lang.NullPointerException
E/AndroidRuntime(2462):位于com.panos.mysqltest.Register$CreateUser.doInBackground(Register.java:101)
E/AndroidRuntime(2462):位于com.panos.mysqltest.Register$CreateUser.doInBackground(Register.java:1)
E/AndroidRuntime(2462):位于android.os.AsyncTask$2.call(AsyncTask.java:287)
E/AndroidRuntime(2462):位于java.util.concurrent.FutureTask.run(FutureTask.java:234)
E/WindowManager(2462):Activity com.panos.mysqltest.Register泄漏了window com.android.internal.policy.impl.PhoneWindow$DecorView{b50cc420 V.E..R..ID 0,0-456144},即
user = (EditText)findViewById(R.id.username);
pass = (EditText)findViewById(R.id.password);
user = (EditText)findViewById(R.id.username1);
pass = (EditText)findViewById(R.id.password1);
   pass = (EditText)findViewById(R.id.password);
   pass = (EditText)findViewById(R.id.password1);
class CreateUser extends AsyncTask<String, String, String>
class CreateUser extends AsyncTask<Void, Void, String>
doInBackground(String... args)
doInBackground(Void... args)
 class CreateUser extends AsyncTask<String, Void, String> {

         /**
         * Before starting background thread Show Progress Dialog
         * */
        boolean failure = false;

    ProgressDialog pDialog ;
        Context _context;




        public CreateUser(Register activity) {
                _context = activity;       // Create a constructor to initialize the `_context`
            }


        @Override
        protected void onPreExecute() {
            super.onPreExecute();
           pDialog = new ProgressDialog(_context);

           pDialog.setMessage("Creating User...");
            pDialog.setIndeterminate(true);
            pDialog.setTitle("Processing");
            pDialog.setCancelable(false);
            pDialog.show();
        }



        @Override
        protected String doInBackground(String... args) {
            // TODO Auto-generated method stub
             // Check for success tag
            int success;

            try {
                // Building Parameters
                List<NameValuePair> params = new ArrayList<NameValuePair>();
                params.add(new BasicNameValuePair("username1",args[0])); // put the values sent from activity i.e username and password.
                params.add(new BasicNameValuePair("password1", args[1]));

                Log.d("request!", "starting");

                //Posting user data to script
                JSONObject json = jsonParser.makeHttpRequest(
                       LOGIN_URL, "POST", params);

                // full json response
                Log.d("Login attempt", json.toString());

                // json success element
                success = json.getInt(TAG_SUCCESS);
                if (success == 1) {
                    Log.d("User Created!", json.toString());
                    finish();
                    return json.getString(TAG_MESSAGE);
                }else{
                    Log.d("Login Failure!", json.getString(TAG_MESSAGE));
                    return json.getString(TAG_MESSAGE);

                }
            } catch (JSONException e) {
                e.printStackTrace();
            }

            return null;

        }
        /**
         * After completing background task Dismiss the progress dialog
         * **/
        protected void onPostExecute(String file_url) {
            // dismiss the dialog once product deleted
            if (pDialog.isShowing())
                    pDialog.dismiss();
            if (file_url != null){
                Toast.makeText(Register.this, file_url, Toast.LENGTH_LONG).show();
            }

        }

    }

        }