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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T01:45:10+00:00 2026-05-28T01:45:10+00:00

I want when i press a specific Button an Image (like a map) to

  • 0

I want when i press a specific Button an Image (like a map) to be displayed. What is more light-weight for my application? Getting this from a url or having it on the drawable folder and just display it?

If I choose the second one, and want to implement a “back” button I will have to put the whole thing in an extra class or not?

My application needs connection to the Internet, regardless of this.

  • 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-28T01:45:11+00:00Added an answer on May 28, 2026 at 1:45 am

    I’d go with a drawable, purely for this reason, what happens when the user starts the app with no wifi/3g/etc. or an extremely slow connection. You say your application needs a connection, but that doesn’t necessarily mean the user will have it enabled when they start the app.

    Its also a lot easier with a drawable, simply put it into the drawable folder then specify it as source for your ImageView (if you are using a clickable imageview)

    <ImageView android:layout_height="wrap_content" android:id="@+id/imageView1"
        android:layout_width="wrap_content" android:src="@drawable/your_image">
    </ImageView>
    

    or as the background if you are using a Button in the xml file.

        <Button android:text="" android:id="@+id/button1"
            android:layout_width="wrap_content" android:layout_height="wrap_content"
            android:background="@drawable/your_image">
        </Button
    

    though you may want to use a selector to change between 2 images (pressed and unpressed state)

    and instead specify the selector xml file as the background/source

    ie android:background="@drawable/back_button_selector"

    Downloading an image needs to be done in a background thread (such as an AsycnTask) or the UI will not respond while the image is downloading.

    But if you decide to download the image for some reason (ie. you want to have the image change without putting out an update and just changing it on the server) here’s an AsyncTask to download an image (you can use it as an inner class)

    public class GetImage extends AsyncTask<ImageView, Void, ImageView> {
    
    String url = null;
    Bitmap thumbnail = null;
    public GetImage(String url){
        this.url = url;
    }
    @Override
    protected void onPreExecute() {
    
    }
    
    @Override
    protected ImageView doInBackground(ImageView... params) {
    
        try {
            thumbnail = BitmapFactory.decodeStream((InputStream) new URL(url).getContent());
    
        } catch (MalformedURLException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return params[0];
    
    }
    
    @Override
    public void onPostExecute(ImageView result) {
        result.setImageBitmap(thumbnail);
    
    }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to print a specific NSView. When I do this, I wish to
I want to trigger an activity via long press on home screen. Is this
In my application I want a customer to not press submit when he didn't
I want to launch safari browser from my IOS app with an specific url
I want to be able to play back video from a specific time using
From what I understand by using code like this: NSURL* appUrl = [NSURL URLWithString:
The Problem I want to press a key when I have a line highlighted
I want my program to press certain keys on my keyboard without me doing
I want to simulate many key press events. I found a solution by using
I want to disable a particular key press in .NET(both VB.NET & C#.NET).``

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.