这是我正在处理的代码。当我使用此代码运行我的应用程序时,它会停止,没有错误。
我已更改 manifest.xml,但它不起作用。
public class MainActivity extends Activity {
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
ok=(Button)findViewById(R.id.Button01);
ok.setOnClickListener(new View.OnClickListener() {
public void onClick(View arg0) {
new jsdetails().execute();
}
});
}
public class jsdetails extends AsyncTask<String,String,String> {
Boolean validUser = false;
@Override
protected void onPreExecute() {
super.onPreExecute();
pDialog = new ProgressDialog(MainActivity.this);
pDialog.setMessage("Verifying.. Please wait...");
pDialog.setIndeterminate(false);
pDialog.setCancelable(false);
pDialog.show();
}
protected String doInBackground(String... args) {
//int valoreOnPostExecute = 0;
error=(TextView)findViewById(R.id.TextView01);
un=(EditText)findViewById(R.id.EditText01);
pw=(EditText)findViewById(R.id.EditText02);
params.add(new BasicNameValuePair("JS_Email",un.getText().toString()));
params.add(new BasicNameValuePair("JS_Password",pw.getText().toString()));
JSONObject json = jParser.makeHttpRequest(url,"POST",params);
Log.d("All Products: ", json.toString());
try {
int success = json.getInt(TAG_SUCCESS);
if (success == 1)
{
validUser = true;
}
} catch (JSONException e) {
e.printStackTrace();
}
return null;
}
protected void onPostExecute(String file_url) {
pDialog.dismiss();
if(validUser)
{
Intent i = new Intent(getApplicationContext(), MainActivity.class);
startActivity(i);
finish();
}
params.clear();
}
}
}