So i was trying to reuse existing code that works in another app, just
changing the namespace, WSDL, Saop action and method name, but getting an
error
Please let me know what im doing wrong or what needs changing or checking.
Here is the error log from the button click
03-18 16:34:05.627: E/AndroidRuntime(9005): FATAL EXCEPTION: main
03-18 16:34:05.627: E/AndroidRuntime(9005): Process:
com.InventoryList.inventory, PID: 9005
03-18 16:34:05.627: E/AndroidRuntime(9005): java.lang.RuntimeException:
Unable to start activity
ComponentInfo{com.InventoryList.inventory/com.InventoryList.inventory.ViewInventoryActivity}:
java.lang.NullPointerException
03-18 16:34:05.627: E/AndroidRuntime(9005): at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2540)
03-18 16:34:05.627: E/AndroidRuntime(9005): at
android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2599)
03-18 16:34:05.627: E/AndroidRuntime(9005): at
android.app.ActivityThread.access$900(ActivityThread.java:174)
03-18 16:34:05.627: E/AndroidRuntime(9005): at
android.app.ActivityThread$H.handleMessage(ActivityThread.java:1321)
03-18 16:34:05.627: E/AndroidRuntime(9005): at
android.os.Handler.dispatchMessage(Handler.java:102)
03-18 16:34:05.627: E/AndroidRuntime(9005): at
android.os.Looper.loop(Looper.java:146)
03-18 16:34:05.627: E/AndroidRuntime(9005): at
android.app.ActivityThread.main(ActivityThread.java:5748)
03-18 16:34:05.627: E/AndroidRuntime(9005): at
java.lang.reflect.Method.invokeNative(Native Method)
03-18 16:34:05.627: E/AndroidRuntime(9005): at
java.lang.reflect.Method.invoke(Method.java:515)
03-18 16:34:05.627: E/AndroidRuntime(9005): at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1291)
03-18 16:34:05.627: E/AndroidRuntime(9005): at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1107)
03-18 16:34:05.627: E/AndroidRuntime(9005): at
dalvik.system.NativeStart.main(Native Method)
03-18 16:34:05.627: E/AndroidRuntime(9005): Caused by:
java.lang.NullPointerException
03-18 16:34:05.627: E/AndroidRuntime(9005): at
com.InventoryList.inventory.ViewInventoryActivity.find_and_modify_text_view(ViewInventoryActivity.java:58)
03-18 16:34:05.627: E/AndroidRuntime(9005): at
com.InventoryList.inventory.ViewInventoryActivity.onCreate(ViewInventoryActivity.java:51)
03-18 16:34:05.627: E/AndroidRuntime(9005): at
android.app.Activity.performCreate(Activity.java:5600)
03-18 16:34:05.627: E/AndroidRuntime(9005): at
android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1093)
03-18 16:34:05.627: E/AndroidRuntime(9005): at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2504)
03-18 16:34:05.627: E/AndroidRuntime(9005): ... 11 more
Like i said, im reusing another apps code, merely changed the above
variables to point to the correct service calls. I know the web service
works cause i built a windows form app to call it and works and returns
great.
So i know the webservice is working and returning what it should.
Here is my code on the page that getting the error when you click the
button.
private Button.OnClickListener get_view_buttonView_Listener = new
Button.OnClickListener() {
public void onClick(View v) {
new ItemTask().execute();
}
};
protected Void doInBackground(final Void... unused){
StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder()
.detectDiskReads()
.detectDiskWrites()
.detectNetwork()
.penaltyLog()
.build());
SoapObject request = new SoapObject(WSDL_TARGET_NAMESPACE,METHOD_NAME);
SoapSerializationEnvelope envelope = new
SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.dotNet = true;
envelope.setOutputSoapObject(request);
HttpTransportSE httpTransport = new HttpTransportSE(URL);
try
{
List<HeaderProperty> invHeaders = new LinkedList<HeaderProperty>();
httpTransport.call(SOAP_ACTION, envelope,
(List<HeaderProperty>)invHeaders);
SoapObject response = (SoapObject)envelope.bodyIn;
if(response != null)
{
SoapObject dataset = (SoapObject) response.getProperty(0);
SoapObject table = (SoapObject) dataset.getProperty("diffgram");
SoapObject dar = (SoapObject) table.getProperty("NewDataSet");
Integer recCount = dar.getPropertyCount();
for (int i=0;i<recCount;i++)
{
SoapObject suvas = (SoapObject) dar.getProperty(i);
if (suvas instanceof SoapObject)
{
String r;
r = suvas.getPropertySafelyAsString("Category").toString();
CategoryValue.setText(r);
}
}
}
}
catch (Exception exception)
{
textViewStatus.setText(exception.toString());
}
return null;
}
protected void onPostExecute(Void result){
if(this.dialog.isShowing()){
this.dialog.dismiss();
}
}
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
---
You received this message because you are subscribed to the Google Groups
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.