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 8256947
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T02:02:26+00:00 2026-06-08T02:02:26+00:00

I am building an Android app in Eclipse and have two similar apps based

  • 0

I am building an Android app in Eclipse and have two similar apps based on the same code base, a ‘London’ one and a ‘UK’ one. To build each app, I just re-name the main package and change a static int in the Application class. The app uses the value of this int to display the right UI, restrict user behaviour, etc.

I have two icon files, one for each app:

  • res/drawable-hdpi/icon_london.png
  • res/drawable-hdpi/icon_uk.png

Is there any way to conditionally use the correct icon file for the Application and Activities depending upon some sort of project configuration setting? Otherwise, the project maintenance is increased as I would have to change my manifest each time the code base changes, e.g.

<application
    android:icon="@drawable/icon_london"
    ...
    >

    <activity
        android:name="com.company.MainActivity" 
        android:logo="@drawable/icon_london"
        >
    </activity>

…and so on, for all the activities.

  • 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-08T02:02:27+00:00Added an answer on June 8, 2026 at 2:02 am

    I had a similar issue, and ended up in building my custon Ant script to build the apps. You can run macros or Regular Expressions to assign one resource or another.

    EDIT:

    First, add build.xml to the project:

    Open up a command prompt and navigate to the directory of your project:

    android update project --path
    

    Then, you can override the existing build.xml, for something like the following.

    NOTE: This Ant script is just an example, I have not tested it:

    <?xml version="1.0" encoding="UTF-8"?>
    <project name="Example" default="help">
        <property file="local.properties" />
        <property file="ant.properties" />
    
        <loadproperties srcFile="project.properties" />
    
        <!-- quick check on sdk.dir -->
        <fail
                message="sdk.dir is missing. Make sure to generate local.properties using 'android update project' or to inject it through an env var"
                unless="sdk.dir"/>
    
        <!-- IMPORT ANT?S BUILD.XML -->
        <import file="${sdk.dir}/tools/ant/build.xml" />
    
        <property name="app.icon"       value="${icon}" />
        <property name="icon.file"      location="res/drawable/icon.png" />
    
        <target name="test-release">
          <antcall target="test-pre-release" />
          <antcall target="release" />
        </target>
    
        <target name="test-pre-release">
          <copy file="${app.icon}" tofile="${icon.file}" overwrite="true"/>
        </target>
    
    </project>
    

    Then, to build this project with a custom icon, open up the command prompt and go to the project directory:

    CALL ant -f build.xml test-release -Dicon=path/to/your/icon.png
    

    As said, this is a very basic example. To build a good script, you’ll have to learn a bit of Ant syntax, but it’s not difficult.

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

Sidebar

Related Questions

I'm building an Android app and I need to have two different themes for
I'm building an Android app using Eclipse. If I have a single Drawable folder
I have been building my android app in an android eclipse environment. Building my
How do I create Android app builds similar to Windows code builds? I have
Problem: I am building Android app in Eclipse which uses shared lib libgstreamer-0.10.so (GStreamer-android
I am building an android app, and I want to be able to have
I am building an Android app using phoneGap and I have successfully added the
I'm building a zip code search page for my Android app so I want
I am building an app for iPhone, android and Blackberry, and I have put
I thought I'd have a crack at building an Android app having not done

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.