Search code examples
androidksoap2android-context

How can I get the IP Server Parameter in a non-activity class


First let me explain what I'm doing...

I have a static class responsible to do my requisition SOAP to the server.

In there I have a static string URL with the IP Server.

It's all right and working fine, but now, I'm going to deploy in the customer's shop, and I need to configure the IP Server when I install the APK in the customer's tablet...

That's my problem. How can I set the IP Server programmatically? I have a "Login" interface, then I can enter like ADMIN Mode and import DB and set the IP...

In the requisition class is a non-activity class, don't have any context and is static...


Solution

  • You must call it with a Context in the Constructor, or you can use a static context in it and set it from the activity, but of course the first solution is the ideal.

    Then you can save the IP to the shared_preferences from your activity, and get it with your context from the class.