[android-developers] kSOAP XmlPullParserException

2013-01-15 Thread Tonez
 

Hey Guys,

I'm stumped on a problem trying to consume a ColdFusion SOAP service in 
Android using kSOAP.  Here is my java code for invoking one of them test 
methods I've written in ColdFusion (which only returns a string):

---

private static final String NAMESPACE = 
> "http://www.sub.tv/MyService.cfc?WSDL";;
> private static String URL = "http://www.sub.tv/MyService.cfc";;
> private static final String METHOD_NAME = "TestMethod";
> private static final String SOAP_ACTION =  
> "http://www.sub.tv/MyService.cfc?method=TestMethod";;
>
 

public void GetData() {
>
 

SoapPrimitive resultstring = null;
> SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
>
 

PropertyInfo inputArgs = new PropertyInfo();
> inputArgs.setName("ID");
> inputArgs.setValue(1234);
> inputArgs.setType(Integer.class);
> request.addProperty(inputArgs);
>
> SoapSerializationEnvelope soapenvelope = new SoapSerializationEnvelope
> (SoapEnvelope.VER11);
> soapenvelope.dotNet = false;
> soapenvelope.setOutputSoapObject(request);
> AndroidHttpTransport httptransport = new AndroidHttpTransport(URL);
> //httptransport.debug = true;
>
 

try {
> httptransport.call(SOAP_ACTION, soapenvelope);
> resultstring = (SoapPrimitive) soapenvelope.getResponse();
> 
> } catch (Exception e) {
> Log.d(DEBUG, e.getMessage());
> } 

}

---

And here is the ColdFusion test method I've written that only returns a 
string:

--

http://www.sub.tv";>
>
 

 description="Test Method">
>   
>
> 
>
> 
> 


--

The error I'm getting when I execute the above Java code is as follows:

> org.xmlpull.v1.XmlPullParserException: expected: START_TAG {
> http://schemas.xmlsoap.org/soap/envelope/}Envelope (position:START_TAG 
> @2:44 in java.io.InputStreamReader@40ff5440) 

 

I suspect the cause of the problem is perhaps the URL I've specified in the 
SOAP_ACTION but, as far as I know, that's the correct way to invoke a 
ColdFusion SOAP web service method.  Executing that URL in the browser 
returns the expected results.  I've tried excluding the manual method call 
in the query string of that URL but I still get the same error.  

Any idea what I'm doing wrong?

Thanks for your time.

Tonez

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] Re: Socket sharing between activities

2012-04-19 Thread Tonez
Hi guys,

Thanks to everyone for the prompt responses.  I've studied up on
Services / IntentServices as well as how I would go about using a
Singleton to satisfy my goal and have decided to give both a try to
take the experiential learning route.  I've started with Services and
have managed to get my app working like it should with binding an
activity in view with the Service running my network thread.  I have a
bug though which I'm having trouble resolving in activity 'A' I'm
using the bindService method to start my service so as to communicate
back and forth between the Service and the activity.  I've created my
service connection like so:

private CallBackActivityAInterface _service = null;

private ServiceConnection serviceConnection = new ServiceConnection()
{
public void onServiceConnected(ComponentName className, IBinder
binder) {
 _service = (CallBackActivityAInterface)binder;

_service.registerActivityACallBack(activityACallBack);
}

public void onServiceDisconnected(ComponentName className) {
 _service = null;
}
}

In my onServiceConnected method above I pass in a call back instance
to the service so it can communicate with activity A from the network
worker thread it is running which is waiting for incoming tcp data.
This is what the CallBackActivityAInterface implementation looks like
in activity A:

private CallBackActivityAInterface activityACallBack = new
CallBackActivityAInterface() {

@Override
public void receivedData() {
runOnUiThread(new Runnable() {

@Override
public void run() {
Log.d(DEBUG, "hoorah we have a 
response");
}
});
}
};

This works fine, when I invoke _activityACallBack.receivedData() in my
service from within the worker thread that's waiting for tcp data I
get my debug output above.  It's worth noting for clarification sake
that the callback instance I pass in to my
_service.registerActivityACallBack(..) method in my service is
assigned to a global variable of type CallBackActivityAInterface
within my service class.

In activity B I have the same sort of implementation as you see above
where I create it's own service connection instance and pass in a
callback to the service so it can communicate with activity B.  When I
navigate to activity B from activity A, I first unbind my service
connection from the running service in activity A and then use the
bindService method in activity B with it's own service connection.
The issue I'm having is the callback instance I'm sending through to
the service in activity B's onServiceConnected method is null when I
try use it from within the worker thread that is currently running in
the service.  This is the callback implementation I have in activity
B:

private CallBackActivityBInterface _service = null;

private ServiceConnection serviceConnection = new ServiceConnection()
{
public void onServiceConnected(ComponentName className, IBinder
binder) {
 _service = (CallBackActivityBInterface)binder;

_service.registerActivityBCallBack(activityBCallBack);
}

public void onServiceDisconnected(ComponentName className) {
 _service = null;
}
}

private CallBackActivityBInterface activityBCallBack = new
CallBackActivityBInterface() {
@Override
public void receivedDataInActivityB() {
runOnUiThread(new Runnable() {

@Override
public void run() {
Log.d(DEBUG, "hoorah we have a response 
in activity B");
}
});
}
};

Stepping through the code reveals that activityBCallBack is not null
when I inspect it within _service.registerActivityBCallBack(..),
however the global variable I assign activityBCallBack to in my
_service.registerActivityBCallBack(..) method is null when I try use
it from within my worker thread that is already running.  Any idea why
this would be null?

I suspect it may be null because the worker thread is started before
activity B has a chance to populate the private global variable with
activityBCallBack so it can be used to communicate with activity B.
But I most certainly do populate the global callback instance the
worker thread is trying to access before it tries to use it.

I've used the following project as a guide:
https://github.com/commonsguy/cw-andtutorials/tree/master/18-LocalService/

Many thanks for the help!

Tonez


On Apr 19, 10:03 am, Android007  wrote:
> Hi,
> I had the same problem as you do (sharing a TCP connection between
> activities) and I must with Dianne that if this is th

[android-developers] Socket sharing between activities

2012-04-16 Thread Tonez
Hi Everyone,

I'm building an Android app which uses TCP sockets to communicate with
a .net server application.  The android app as a whole relies quite
heavily on TCP and as such nearly all the features in the app require
writing to and listening from a socket stream.  I'm trying to
determine what the best design approach is for having more than one
activity utilize a live active socket.

I've recently just finished building an iPhone version of this app,
the way in which I got each feature (different view controllers) to
use one live active socket connection was by passing the live socket
instance to each view controller, each view controller would then
retain ownership of that socket and as such the delegate methods which
fire when a transmission is received work as expected.  Trying to
simulate this design in Android is proving to be a pain because I
can't pass a live socket instance to another activity as part of an
intent parameter.

If I wanted to have activity A listen for incoming TCP data, and then
navigate to Activity B but then have activity B send TCP data to
the .net server and of-course spawn a new thread to listen for
incoming TCP data - what would be the best approach to achieve this?

At the moment what I have is as follows:  activity A spawns a new
thread listening for incoming TCP data, activity A can communicate
with the .net server perfectly fine.  When I navigate to activity B
and then want to communicate with the .net server - creating a new
socket instance and then listening for incoming data results in
activity A's readLine() method receiving the data.  Which makes sense,
it's still running - but obviously the goal is to have activity B
receive this data.

An alternative approach I tried was to close down the TCP socket I
have in activity A when opening up another TCP socket connection when
I need to use TCP in activity B - although this somewhat works it
really feels like the wrong way to go about it.

And lastly, one other approach I've thought of is to have one activity
handling all TCP comms with the .net server and contain all the
functionality in this one activity by swapping out .xml layout files
when necessary.  Obviously this will result in one massive .java file
and again is a route which feels wrong.

Any advice on how I can go about designing my app given that I want to
use TCP functionality in every activity would be greatly appreciated.

Many thanks,

Tonez

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: TCP Socket communication between C# and Android

2011-11-04 Thread Tonez
Thanks for the responses.  Serene is spot on, sending a newline
character does the trick.  My while loop continues execution if a
newline character is received and within the while loop I added a
check for this and break out of it to continue code execution.  Thank
you all again for the help!

On Nov 2, 5:50 am, serene  wrote:
> From the .net socket , canu try to send the message with a new line
> character at the end of message. ??
>
> On Nov 1, 1:39 pm, Tonez  wrote:
>
>
>
>
>
>
>
> > Hi Everyone,
>
> > I have a .net c# application acting as a server listening on a
> > particular port, and an Android app that I'm building acting as the
> > client which will connect and send / receive tcp messages to / from
> > the .net server application.  I have it working at the moment but am
> > faced with a challenge that I'm hoping has a better solution than the
> > one I've implemented.  My Android app connects to the .net server
> > fine, upon successfully connecting the .net application sends back a
> > tcp message - my Android app receives this message but it won't
> > continue code execution whilst it's reading the connected stream
> > unless I close the network stream in the .net server application.
> > Below is the bit of code which handles reading / writing to the
> > network stream:
>
> > out = new PrintWriter( new BufferedWriter( new
> > OutputStreamWriter(socketObj.getOutputStream())), true);
> > in = new BufferedReader( new
> > InputStreamReader( socketObj.getInputStream()));
>
> > out.printLn("my command");
>
> > String text = "";
> > String responseStr = "";
>
> > while ((text = in.readLine()) != null) {
> > responseStr += text;
>
> > }
>
> > So the while loop above continues to execute until I close the network
> > stream in the .net app.  Is there some way of specifying to the
> > Android / Java network stream that the data being sent has ended so it
> > can break out that while loop and continue code execution apart from
> > closing down the network stream on the .net side?
>
> > Thanks for the help.
>
> > T

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] TCP Socket communication between C# and Android

2011-11-01 Thread Tonez
Hi Everyone,

I have a .net c# application acting as a server listening on a
particular port, and an Android app that I'm building acting as the
client which will connect and send / receive tcp messages to / from
the .net server application.  I have it working at the moment but am
faced with a challenge that I'm hoping has a better solution than the
one I've implemented.  My Android app connects to the .net server
fine, upon successfully connecting the .net application sends back a
tcp message - my Android app receives this message but it won't
continue code execution whilst it's reading the connected stream
unless I close the network stream in the .net server application.
Below is the bit of code which handles reading / writing to the
network stream:

out = new PrintWriter( new BufferedWriter( new
OutputStreamWriter(socketObj.getOutputStream())), true);
in = new BufferedReader( new
InputStreamReader( socketObj.getInputStream()));

out.printLn("my command");

String text = "";
String responseStr = "";

while ((text = in.readLine()) != null) {
responseStr += text;
}

So the while loop above continues to execute until I close the network
stream in the .net app.  Is there some way of specifying to the
Android / Java network stream that the data being sent has ended so it
can break out that while loop and continue code execution apart from
closing down the network stream on the .net side?

Thanks for the help.

T

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: InflateException: Error inflating class issue

2011-10-03 Thread Tonez
I believe I've found what the issue is.  After taking a closer look at
LogCat I noticed there was a FileNotFound exception further down the
stack, which makes no sense because the files are there - so I decided
to move all my mdpi files into a folder named simply 'drawable' - and
that sorted out the error, app seems to be working fine now.  I
presume the ldpi/mdpi/hdpi named drawable folders weren't used in in
Android os versions prior to and including 2.0?

Anyway hope this helps someone.

Cheers.

- T

On Oct 3, 12:46 pm, Tonez  wrote:
> Hi Everyone,
>
> I have an app which I'm testing out on Android 2.0 (emulator) that's
> currently throwing me an error - of which I've found the cause.  The
> error is:
>
> android.view.InflateException: Binary XML file line #7: Error
> inflating class 
>
> This error is being thrown when my activity tries to inflate a layout
> file with background images in it.  If I remove the background images
> from the elements within that layout file, I don't get the error
> anymore and my layout file get's loaded into view - only without the
> artwork ofcourse.  I've googled around and have found other instances
> of this error being caused by the size of the images used being too
> large.  My background images aren't large at all, kb sizes are as
> follows for the largest background image in that layout file:
>
> hdpi:  102kb
> mdpi:  66.2kb
> ldpi:  66.2kb
>
> I have three other images in the layout file that don't exceed 14kb in
> size.  I've tried removing the largest image in the layout file to see
> if the others which are a lot less in size would still cause this
> error to be thrown and unfortunately it does.
>
> Worth mentioning that I don't have this problem on Android 2.0.1 and
> above, and all my images are pngs.
>
> Any suggestions would be very much appreciated.
>
> Thanks!
>
> - Tonez

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] InflateException: Error inflating class issue

2011-10-03 Thread Tonez
Hi Everyone,

I have an app which I'm testing out on Android 2.0 (emulator) that's
currently throwing me an error - of which I've found the cause.  The
error is:

android.view.InflateException: Binary XML file line #7: Error
inflating class 

This error is being thrown when my activity tries to inflate a layout
file with background images in it.  If I remove the background images
from the elements within that layout file, I don't get the error
anymore and my layout file get's loaded into view - only without the
artwork ofcourse.  I've googled around and have found other instances
of this error being caused by the size of the images used being too
large.  My background images aren't large at all, kb sizes are as
follows for the largest background image in that layout file:

hdpi:  102kb
mdpi:  66.2kb
ldpi:  66.2kb

I have three other images in the layout file that don't exceed 14kb in
size.  I've tried removing the largest image in the layout file to see
if the others which are a lot less in size would still cause this
error to be thrown and unfortunately it does.

Worth mentioning that I don't have this problem on Android 2.0.1 and
above, and all my images are pngs.

Any suggestions would be very much appreciated.

Thanks!

- Tonez

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: map does not displaying in device

2011-08-05 Thread Tonez
Ratheesh didn't indicate if he's prepping his app for release, if he
is then of-course, don't set the application's debuggable property to
true.  He can do so though if he's still testing, in my case it was
the quickest way to accurately test my implementation for retrieving a
users location.


On Aug 5, 2:33 pm, Nick Risaro  wrote:
> On Fri, Aug 5, 2011 at 6:59 AM, Tonez  wrote:
> > Hi Ratheesh,
>
> > I've been having the same problem, up until a few minutes ago when I
> > sorted it out.  The way in which I resolved this issue was by making
> > sure the debuggable property of my application tag in
> > AndroidManifest.xml is set to true - you can also do this by going to
>
> Please don't do that!! your release application should not be debuggable.
>
> Check the group yesterday somebody asked the same, you need another key for
> the signed application.

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: map does not displaying in device

2011-08-05 Thread Tonez
Hi Ratheesh,

I've been having the same problem, up until a few minutes ago when I
sorted it out.  The way in which I resolved this issue was by making
sure the debuggable property of my application tag in
AndroidManifest.xml is set to true - you can also do this by going to
the Application tab in your AndroidManifest.xml file and setting
debuggable to true.  Uninstall your .apk file using the settings
feature of your device, and clean your project.  Power down your
device and start it back up.  Then try debugging your app again on the
device.

Hope that helps.

Cheers.


On Aug 5, 6:47 am, Ratheesh Valamchuzhy  wrote:
> Hi alll
>
>  I am developing an applicatin which displays google map in android phone ,
> i already take the Api key from google and put it to the XML file ... iam
> using Goolgle MAp API level 8
>
> my prblem is the map is displaying in the emulater not in the Android  phone
>
> Any one help me to do that.. i searched abt it and make the changes ,
> but i am not getting it plse.
> --
> --
> ωιтн яєgαя∂ѕ
> Ratheesh **...

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: MapView Tiles not loading on my device, they are in my emulator

2011-08-05 Thread Tonez
Ok I got it sorted.  All that was needed was rebooting my device.  I
never really turn it off, whenever I make changes to my .apk i
uninstall it using the settings of my device - evidentally in this
case that wasn't enough.

Cheers for the help :).

On Aug 5, 10:15 am, Tonez  wrote:
> Hi TreKing,
>
> Thanks for the response.  After checking my application tag to see if
> "debuggable=true" was there I actually didn't have it in there, after
> putting it in I still can't get my map tiles to load on my device
> using my debug api key (I cleaned my project, uninstalled my app from
> the phone using settings to make sure the updated .apk file was being
> transferred).
>
> Is it even possible to debug the map view on a device using a debug
> api key?  I'm under the impression that it is as I didn't see anything
> in the Google instructions where it states that you need to use a
> release key to load map tiles on a device.
>
> Just so I understand your last comment about release mode:  in order
> to switch to release mode, is taking out the "debuggable=true" all
> that is needed?
>
> Thanks, any help is greatly appreciated.
>
> On Aug 5, 12:36 am, TreKing  wrote:
>
>
>
>
>
>
>
> > On Thu, Aug 4, 2011 at 11:40 AM, Tonez  wrote:
> > > Can anyone shed some light as to what it is that I'm missing to get the
> > > mapView tiles to load on my device for testing?
>
> > If you are still debugging ("debuggable = true") then that should work. If
> > you switched to release mode, you now need a separate key for your release /
> > signing certificate.
>
> > --- 
> > --
> > TreKing <http://sites.google.com/site/rezmobileapps/treking> - Chicago
> > transit tracking app for Android-powered devices

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: MapView Tiles not loading on my device, they are in my emulator

2011-08-05 Thread Tonez
Hi TreKing,

Thanks for the response.  After checking my application tag to see if
"debuggable=true" was there I actually didn't have it in there, after
putting it in I still can't get my map tiles to load on my device
using my debug api key (I cleaned my project, uninstalled my app from
the phone using settings to make sure the updated .apk file was being
transferred).

Is it even possible to debug the map view on a device using a debug
api key?  I'm under the impression that it is as I didn't see anything
in the Google instructions where it states that you need to use a
release key to load map tiles on a device.

Just so I understand your last comment about release mode:  in order
to switch to release mode, is taking out the "debuggable=true" all
that is needed?

Thanks, any help is greatly appreciated.


On Aug 5, 12:36 am, TreKing  wrote:
> On Thu, Aug 4, 2011 at 11:40 AM, Tonez  wrote:
> > Can anyone shed some light as to what it is that I'm missing to get the
> > mapView tiles to load on my device for testing?
>
> If you are still debugging ("debuggable = true") then that should work. If
> you switched to release mode, you now need a separate key for your release /
> signing certificate.
>
> --- 
> --
> TreKing <http://sites.google.com/site/rezmobileapps/treking> - Chicago
> transit tracking app for Android-powered devices

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] MapView Tiles not loading on my device, they are in my emulator

2011-08-04 Thread Tonez
Hi Everyone,

I'm currently building an app which utilizes the mapView component -
I've gotten to the point where I need to test on an actual device but
unfortunately the mapView tiles won't load.  Steps I took to get to
this point are as follows:  I followed the instruction on the
'Obtaining a Maps API Key' Google web page and retrieved an API key
using an MD5 fingerprint from my debug certificate.  Pasted it into
the android:apiKey property of my mapView and fired up my emulator.
Works perfectly - mapView tiles load as expected.  Without touching my
project, I tried debugging on the device and doing so results in the
tiles of my mapView not loading at all.

The device I'm testing on is an LG GT540 running Android 2.1-update1.

Can anyone shed some light as to what it is that I'm missing to get
the mapView tiles to load on my device for testing?

Many thanks.

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en