Click here to Skip to main content
15,881,636 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
LOG CAT

05-21 10:56:27.399  21874-22114/com.example.isandeep.trydemo I/global﹕ In close() at SocketHttpClientConnection<br />
05-21 10:56:27.409  21874-22114/com.example.isandeep.trydemo I/global﹕ call createSocket() return a new socket.<br />
05-21 10:56:27.439  21874-21874/com.example.isandeep.trydemo I/Adreno200-EGLSUB﹕ <ConfigWindowMatch:1991>: Format RGBA_8888.<br />
05-21 10:56:30.131  21874-21874/com.example.isandeep.trydemo V/AsyncHttpResponseHandler﹕ Progress 86 from 196 (44%)<br />
05-21 10:56:30.131  21874-21874/com.example.isandeep.trydemo D/Res:﹕ [ 05-21 10:56:30.161 22093:0x5660 I/AccountTypeManager ]<br />
    Loaded meta-data for 11 account types, 10 accounts in 371ms(wall) 90ms(cpu)<br />
05-21 10:56:30.191  21874-21874/com.example.isandeep.trydemo W/System.err﹕ org.json.JSONException: End of input at character 1 of<br />
05-21 10:56:30.201  21874-21874/com.example.isandeep.trydemo W/System.err﹕ at org.json.JSONTokener.syntaxError(JSONTokener.java:450)<br />
05-21 10:56:30.201  21874-21874/com.example.isandeep.trydemo W/System.err﹕ at org.json.JSONTokener.nextValue(JSONTokener.java:97)<br />
05-21 10:56:30.201  21874-21874/com.example.isandeep.trydemo W/System.err﹕ at org.json.JSONObject.<init>(JSONObject.java:154)<br />
05-21 10:56:30.201  21874-21874/com.example.isandeep.trydemo W/System.err﹕ at org.json.JSONObject.<init>(JSONObject.java:171)<br />
05-21 10:56:30.201  21874-21874/com.example.isandeep.trydemo W/System.err﹕ at com.example.isandeep.trydemo.MainActivity$2.onSuccess(MainActivity.java:98)<br />
05-21 10:56:30.201  21874-21874/com.example.isandeep.trydemo W/System.err﹕ at com.example.isandeep.trydemo.MainActivity$2.onSuccess(MainActivity.java:87)<br />
05-21 10:56:30.201  21874-21874/com.example.isandeep.trydemo W/System.err﹕ at com.loopj.android.http.AsyncHttpResponseHandler.handleMessage(AsyncHttpResponseHandler.java:311)<br />
05-21 10:56:30.201  21874-21874/com.example.isandeep.trydemo W/System.err﹕ at com.loopj.android.http.AsyncHttpResponseHandler$ResponderHandler.handleMessage(AsyncHttpResponseHandler.java:138)<br />
05-21 10:56:30.201  21874-21874/com.example.isandeep.trydemo W/System.err﹕ at android.os.Handler.dispatchMessage(Handler.java:99)<br />
05-21 10:56:30.201  21874-21874/com.example.isandeep.trydemo W/System.err﹕ at android.os.Looper.loop(Looper.java:156)<br />
05-21 10:56:30.201  21874-21874/com.example.isandeep.trydemo W/System.err﹕ at android.app.ActivityThread.main(ActivityThread.java:4987)<br />
05-21 10:56:30.201  21874-21874/com.example.isandeep.trydemo W/System.err﹕ at java.lang.reflect.Method.invokeNative(Native Method)<br />
05-21 10:56:30.201  21874-21874/com.example.isandeep.trydemo W/System.err﹕ at java.lang.reflect.Method.invoke(Method.java:511)<br />
05-21 10:56:30.201  21874-21874/com.example.isandeep.trydemo W/System.err﹕ at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)<br />
05-21 10:56:30.201  21874-21874/com.example.isandeep.trydemo W/System.err﹕ at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)<br />
05-21 10:56:30.201  21874-21874/com.example.isandeep.trydemo W/System.err﹕ at dalvik.system.NativeStart.main(Native Method)<br />
05-21 10:56:30.201  21874-21874/com.example.isandeep.trydemo D/OpenGLRenderer﹕ Flushing caches (mode 0)<br />
05-21 10:56:30.211  21874-21874/com.example.isandeep.trydemo D/memalloc﹕ /dev/pmem: Unmapping buffer base:0x4e7c8000 size:3338240 offset:3215360<br />
05-21 10:56:30.211  21874-21874/com.example.isandeep.trydemo D/memalloc﹕ /dev/pmem: Unmapping buffer base:0x4eaf7000 size:3579904 offset:3457024<br />
05-21 10:56:30.211  21874-21874/com.example.isandeep.trydemo D/memalloc﹕ /dev/pmem: Unmapping buffer base:0x4ef51000 size:3702784 offset:3579904<br />
05-21 10:56:33.705  21874-21874/com.example.isandeep.trydemo D/memalloc﹕ /dev/pmem: Unmapping buffer base:0x4e59e000 size:3579904 offset:3457024<br />
05-21 11:00:20.516  21874-21874/com.example.isandeep.trydemo W/IInputConnectionWrapper﹕ showStatusIcon on inactive InputConnection<br />
05-21 11:00:20.526  21874-21874/com.example.isandeep.trydemo W/IInputConnectionWrapper﹕ InputConnection = com.android.internal.widget.EditableInputConnection@40e1b8d0, active client = false<br />





Android code
import android.app.ProgressDialog;
import android.support.v7.app.ActionBarActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;

import org.apache.http.Header;
import org.json.JSONException;
import org.json.JSONObject;

import com.loopj.android.http.AsyncHttpClient;
import com.loopj.android.http.AsyncHttpResponseHandler;
import com.loopj.android.http.RequestParams;


public class MainActivity extends ActionBarActivity {

EditText et1,et2,et3,et4,et5,et6,et7,et8;
Button btn;
ProgressDialog prgDialog;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);

// Instantiate Progress Dialog object
prgDialog= new ProgressDialog(this);
// Set Progress Dialog Text
prgDialog.setMessage("Please wait...");
// Set Cancelable as False
prgDialog.setCancelable(false);


et1 = (EditText)findViewById(R.id.Demo1);
et2 = (EditText)findViewById(R.id.Demo2);
et3 = (EditText)findViewById(R.id.Demo3);
et4 = (EditText)findViewById(R.id.Demo4);
et5 = (EditText)findViewById(R.id.Demo5);
et6 = (EditText)findViewById(R.id.Demo6);
et7 = (EditText)findViewById(R.id.Demo7);
et8 = (EditText)findViewById(R.id.Demo8);

btn = (Button)findViewById(R.id.btnDemo);


btn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
RequestParams params = new RequestParams();
params.put("Name",et1.getText().toString());
params.put("Addre",et2.getText().toString());
params.put("Gen",et3.getText().toString());
params.put("Phone",et4.getText().toString());
params.put("mobile",et5.getText().toString());
params.put("Occu",et6.getText().toString());
params.put("UserNm",et7.getText().toString());
params.put("Pwd",et8.getText().toString());
prgDialog.show();
invokeWS(params);
}
});
}


public void invokeWS(RequestParams params){
// Show Progress Dialog
prgDialog.show();
// Make RESTful webservice call using AsyncHttpClient object
AsyncHttpClient client = new AsyncHttpClient();
//""

client.get("http://MyDomain.com/MyService.asmx/ReceiveInsertUsser",params ,new AsyncHttpResponseHandler() {
@Override
public void onSuccess(int i, Header[] headers, byte[] bytes) {
onSuccess(" ");
}

public void onSuccess(String response) {

Log.d("Res: ",response);

// Hide Progress Dialog
prgDialog.hide();
try {
// JSON Object
JSONObject obj = new JSONObject(response);
// When the JSON response has status boolean value assigned with true
if(obj.getString("status")!=null){
// Display successfully registered message using Toast
Toast.makeText(getApplicationContext(), "You are successfully registered!", Toast.LENGTH_LONG).show();
}
else{// Else display error message

Log.d("Error: ", obj.getString("error_msg"));

Toast.makeText(getApplicationContext(), obj.getString("error_msg"), Toast.LENGTH_LONG).show();
}
} catch (JSONException e) {
// TODO Auto-generated catch block
Toast.makeText(getApplicationContext(), "Error Occured [Server's JSON response might be invalid]!", Toast.LENGTH_LONG).show();
e.printStackTrace();
}
}

@Override
public void onFailure(int statusCode, Header[] headers, byte[] bytes, Throwable throwable) {

// Hide Progress Dialog
prgDialog.hide();

if(statusCode == 404){
Toast.makeText(getApplicationContext(), "Requested resource not found", Toast.LENGTH_LONG).show();
Log.d("Status Code: " + statusCode,"Requested resource not found");
}

else if(statusCode == 500){
Log.d("Status Code: " + statusCode,"Something went wrong at server end");
Toast.makeText(getApplicationContext(), "Something went wrong at server end", Toast.LENGTH_LONG).show();
}

else{
Log.d("Status Code: " + statusCode,"Unexpected Error occcured! [Most common Error: Device might not be connected to Internet or remote server is not up and running]");
Toast.makeText(getApplicationContext(), "Unexpected Error occcured! [Most common Error: Device might not be connected to Internet or remote server is not up and running]", Toast.LENGTH_LONG).show();
}
}


});
}
}
Posted
Comments
Richard MacCutchan 21-May-15 3:59am    
Please do not just dump all your code here and expect someone to analyse and fix it for you. Edit your question, format your code properly (using <pre> rather than <code> tags), and explain exactly what the error is and where it occurs.
i_Sandeep 27-May-15 5:15am    
ok Richard MacCutchan, i'll remember this for next time. thank you

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900