Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7962583
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T05:22:41+00:00 2026-06-04T05:22:41+00:00

I want to have my app switch between development and production web services without

  • 0

I want to have my app switch between development and production web services without changing too much in the code (and be relatively fool proof).

Right now I have my web service addresses as static final String variables in the class that does the actual HTTP calls and switch code in the rest of the app by using a static final boolean.

Now whereas the boolean is pretty convenient, I can’t use it to change the web service addresses because they are themselves static final variables. What is the best practice for tackling this ?

I found some discussions on SO that directed towards using Android SDK provided debug variable but although it can replace the boolean, it doesn’t solve the other problem.

NOTE: In case you are wondering, I’m using the web services class statically so I don’t have a constructor in which I can check the debug variable and change variables, plus I’d also like them to be static final.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T05:22:42+00:00Added an answer on June 4, 2026 at 5:22 am

    I promised I’d do it and here it is:

    • http://blog.blundellapps.com/switching-android-configurations-using-constants-and-ant/
    • http://blog.blundellapps.com/running-an-ant-script-with-eclipse/

    Also mirrored on GitHub: https://github.com/blundell/BuildChoiceTut

    With the tutorial, you can switch configurations using Ant build scripts.

    You setup a directory called /config/ in here you hold all your constants for different configurations. Once for each file i.e. live.props dev.props beta.props

    Then, when Ant runs, it will read the selected file and ‘inject’ them into your build just before it is compiled.

    Enjoy!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In order to switch between views in my iOS app, I have been using
I have a Navigation Controller app and I'm using this code to switch views:
I have an App that I want to have two version in the App
I have an app and want to have a contact us for where the
I have intended to have an app. where I want to have different things
I have app in which i have recorded sound files i want that i
I want to have a java app running, using a function/method (with as little
I have an app where we want users to be able to send us
I have an app that I want to be launchable either explicitly when tapped
I have an app that I want to develop for Android 2.1, 2.2, 2.3.3,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.