خطا در نمایش اکتیوتی بعد از اجرای دستورات وب سرویس
سلام.من از یک وب سرویس استفاده میکنم به عنوان بانک اطلاعاتی نرم افزار.
فرم اول نرم افزار فرم ورود کاربران هست .من وقتی اطلاعات کاربری را وارد میکنم به وب سرویس متصل میشوم و تایید کاربری را به من گزارش میدهد و من میخوام بعد از تایید گزارش اکتیویتی بعد به من نمایش بدهد ولی نرم افزار خطا میدهد و به صفحه بعد نمی رود.



@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_login);
Button btn_login=(Button)findViewById(R.id.btn_login);
final EditText txt_username=(EditText)findViewById(R.id.txt_username);
final EditText txt_password=(EditText)findViewById(R.id.txt_password);
btn_login.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if(getDataSql()==1) {
Intent intent = new Intent(G.currentactivity, MainActivity.class);
//intent.putExtra("NAME_USER", obj3.getProperty("***").toString());
// intent.putExtra("USER_ID", obj3.getProperty("***").toString());
G.currentactivity.startActivity(intent);
}
else{
Toast.makeText(G.context,"خطا در اتصال",Toast.LENGTH_LONG).show();
}
}
});
}
public int getDataSql()
{
int resu=0;
StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build();
StrictMode.setThreadPolicy(policy);
final EditText txt_username=(EditText)findViewById(R.id.txt_username);
final EditText txt_password=(EditText)findViewById(R.id.txt_password);
SoapObject obj, obj1, obj2, obj3;
SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
//Use this to add parameters
request.addProperty("***", "***");
//Declare the version of the SOAP request
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.setOutputSoapObject(request);
envelope.dotNet = true;
try {
HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);
//this is the actual part that will call the webservice
androidHttpTransport.call(SOAP_ACTION, envelope);
// Get the SoapResult from the envelope body.
SoapObject result = (SoapObject) envelope.bodyIn;
if (result != null)
{
//Get the first property and change the label text
obj = (SoapObject) envelope.getResponse();
obj1 = (SoapObject) obj.getProperty("diffgram");
obj2 = (SoapObject) obj1.getProperty("DocumentElement");
if(obj2.getPropertyCount()>0) {
obj3 = (SoapObject) obj2.getProperty(0);
resu=1;
//Intent intent = new Intent(G.context, MainActivity.class);
//intent.putExtra("NAME_USER", obj3.getProperty("***").toString());
//intent.putExtra("USER_ID", obj3.getProperty("***").toString());
//startActivity(intent);
}
}
else
{
resu=0;
}
}
catch (Exception e) {
resu=0;
}
return resu;
}
پاسخگویی و مشاهده پاسخ های این سوال تنها برای اعضای ویژه سایت امکان پذیر است .
چنانچه تمایل دارید به همه بخش ها دسترسی داشته باشید میتوانید از این بخش لایسنس این آموزش را خریداری نمایید .