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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T02:00:06+00:00 2026-05-18T02:00:06+00:00

I have 10 URL’s in my application, that are currently hard-coded. I want to

  • 0

I have 10 URL’s in my application, that are currently hard-coded. I want to externalize this and put it in a file so that my application can read it in.

What is the best way of doing this?

private String appURL = "http://..."
private String storeURL = "http://..."
private String someURL = "http://..."

Note: I will never be writing out to this file in my app. I want the developer to be able to open up the file, and change the URL if necessary.

  • 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-05-18T02:00:06+00:00Added an answer on May 18, 2026 at 2:00 am

    Easiest way to externalize strings in an android application is to use string resources. Create file uris.xml at res/values folder:

    <?xml version="1.0" encoding="utf-8"?>
    <resources>
        <string name="appUrl">http://...</string>
        <string name="storeUrl">http://...</string>
        <!-- etc /-->
    </resources>
    

    You then can then access the strings by:

    String appUrl = getString(R.string.appUrl);
    String storeUrl = getString(R.string.storeUrl);
    //..etc
    

    getString() is a method of Context class. Also keep in mind that you should wait until a Context will be initialized before starting access its resources. Hence invoke getString() not earlier then at onCreate() method of Activity or Application.

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

Sidebar

Related Questions

I want to have url like this in my application http://website.com/click/http://google.com with Route::set('click', 'click(/<action>(/<link>))',
I have url, for example: http://i.myhost.com/myimage.jpg I want to change this url to http://i.myhost.com/myimage
I have url that looks like this... http://www.example.com/accounts/?token=111978178853984|683b8096732be7fd725d3332-557626087|m9lSbmoYhZ6Yut4OC3smY1fRf1E. from the token 111978178853984|683b8096732be7fd725d3332- 557625434 |m9lSbmoYhZ6Yut4OC3smY1fRf1E
I have a site that have URL similar to this: /mysite/admin/controller/action/id /mysite/search/controller/action/id /mysite/user/controller/action/id I
I have url like this which is a js file example like this link
I have url, comicsbook.ru/upload/13307036534f50ed2593fa8.jpg, but i can't parse this, NOT ONE of this methods
Is it possible to make url with custom literal separator that can have default
Imagine that I have url http://www.google.com/subdomain/blah-blah.../.. /.. So I want to extract 4 things
Currently i have url parameters like this http://www.website.com/index.php?user&page=edit And in index.php i have set
So I have url like this: example.com?category=Home&category=Test I know that in the views I

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.