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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T23:16:55+00:00 2026-05-19T23:16:55+00:00

i am trying to show an image directly under a text which i had

  • 0

i am trying to show an image directly under a text which i had retrieved from a file in the sdcard but only the text is showing but not the image,

have been trying several methods but non of it is workable

below is my code to display them

//Find the directory for the SD Card using the API
    //*Don't* hardcode "/sdcard"
    File sdcard = Environment.getExternalStorageDirectory();

    //Get the text file
    File file = new File(sdcard,"file.txt");

    //Read text from file
    StringBuilder text = new StringBuilder();

    try {
        BufferedReader br = new BufferedReader(new FileReader(file));
        String line;

        while ((line = br.readLine()) != null) {
            text.append(line);
            text.append('\n');
        }
    }
    catch (IOException e) {
        //You'll need to add proper error handling here
    }

    //Find the view by its id
    TextView tv = (TextView)findViewById(R.id.TextView01);

    //Set the text
    tv.setText(text);

    Bitmap bitmap = BitmapFactory.decodeResource(getResources(),R.drawable.icon);
    Canvas canvas = new Canvas(bitmap);
    canvas.drawColor(Color.BLACK);
    canvas.drawBitmap(bitmap, 130, 10, null);
  • 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-19T23:16:56+00:00Added an answer on May 19, 2026 at 11:16 pm

    Well, I don’t see anywhere in your code where you are trying to set the bitmap. Whatever, what about using compounds drawables?

    //Find the view by its id
    TextView tv = (TextView)findViewById(R.id.TextView01);
    
    //Set the text
    tv.setText(text);
    
    tv.setCompoundDrawablesWithIntrinsicBounds(null,
       null, null, getResources().getDrawable(R.drawable.icon));
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to show thumbnail images in Django admin, but I can only see
i'm trying to load image from local disk, and it's working. But my problem
i'm trying to load image from local disk, and it's working. But my problem
I'm trying to show 16 by 16 pixel image at X=100 & Y=100 but
hi i am trying to show image of my file in previwew pane i
I am trying to show a graph image which is horizontally long. The problem
I'm trying to show a zoomed in overlay on an image when mouse over
First I'm going to show you an image of what I'm trying to recreate
The following image have been uploaded to show what I am trying to do
What I am trying to do is to show both background-color and background-image ,

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.