My app works fine on Wifi but on GPRS it gives the following error and crashes saying FC any idea why is this happening-Collection of common programming errors
this kind of code im using
private static String SOAP_ACTION = "http://schemas.xmlsoap.org/soap/http";
private static String NAMESPACE = "http://schemas.xmlsoap.org/soap/encoding/";
private static String METHOD_NAME = "something";
private static String URL = "http://server/file.php?wsdl";
parameters.addProperty("SubMSISDN", msisdn);
parameters.addProperty("AppID", 2);
request.addProperty(METHOD_NAME, parameters);
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.setOutputSoapObject(request);
HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);
try{
androidHttpTransport.call(SOAP_ACTION, envelope);
}catch (Exception e) {
// TODO: handle exception
e.printStackTrace();
}
try{
result = (SoapObject) envelope.bodyIn;
}catch(NullPointerException e ){
e.printStackTrace();
Toast.makeText(getApplicationContext(), "Please check your internet connection", Toast.LENGTH_LONG).show();
}
if(result != null){
do rest of work here
}
This is error log
12-13 16:24:16.519: E/AndroidRuntime(14087): FATAL EXCEPTION: main
12-13 16:24:16.519: E/AndroidRuntime(14087): java.lang.NullPointerException
12-13 16:24:16.519: E/AndroidRuntime(14087): at android.app.Instrumentation.execStartActivity(Instrumentation.java:1374)
12-13 16:24:16.519: E/AndroidRuntime(14087): at android.app.Activity.startActivityForResult(Activity.java:2827)
12-13 16:24:16.519: E/AndroidRuntime(14087): at android.app.Activity.startActivity(Activity.java:2933)
12-13 16:24:16.519: E/AndroidRuntime(14087): at com.syntecx.selfcare.BalanceHis$1.onPostExecute(BalanceHis.java:195)
12-13 16:24:16.519: E/AndroidRuntime(14087): at com.syntecx.selfcare.BalanceHis$1.onPostExecute(BalanceHis.java:1)
12-13 16:24:16.519: E/AndroidRuntime(14087): at android.os.AsyncTask.finish(AsyncTask.java:417)
12-13 16:24:16.519: E/AndroidRuntime(14087): at android.os.AsyncTask.access$300(AsyncTask.java:127)
12-13 16:24:16.519: E/AndroidRuntime(14087): at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:429)
12-13 16:24:16.519: E/AndroidRuntime(14087): at android.os.Handler.dispatchMessage(Handler.java:99)
12-13 16:24:16.519: E/AndroidRuntime(14087): at android.os.Looper.loop(Looper.java:123)
12-13 16:24:16.519: E/AndroidRuntime(14087): at android.app.ActivityThread.main(ActivityThread.java:3687)
12-13 16:24:16.519: E/AndroidRuntime(14087): at java.lang.reflect.Method.invokeNative(Native Method)
12-13 16:24:16.519: E/AndroidRuntime(14087): at java.lang.reflect.Method.invoke(Method.java:507)
12-13 16:24:16.519: E/AndroidRuntime(14087): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:867)
12-13 16:24:16.519: E/AndroidRuntime(14087): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:625)
12-13 16:24:16.519: E/AndroidRuntime(14087): at dalvik.system.NativeStart.main(Native Method)
it works fine when im using wifi but in some devices on gprs the application crashes and give a force close when i debuged the app the above mentioned log created showing the problem