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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T08:32:34+00:00 2026-05-18T08:32:34+00:00

I my project I have a class that in this class I want to

  • 0

I my project I have a class that in this class I want to have access to properties of a picture. But I don’t want to show it through this class. In this class I just want to know width and height of image and do some mathematical functions to return something.

My problem is I can’t have access to resources. for example, when I write

image = BitmapFactory.decodeResource(this.getResources(), R.drawable.tasnim);

It says the method getResources() in undefined for the type Stego (stego is my class name).

Please tell me what should I do?

public class Stego()
{
    Public Stego(){
        image = BitmapFactory.decodeResource(this.getResources(), R.drawable.tasnim);
        imWidth  = image.getWidth();
        imHeight = image.getHeight();
    }
}
  • 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-18T08:32:35+00:00Added an answer on May 18, 2026 at 8:32 am

    The getResources() function belongs to the Context class. So unless your Stego class directly (or indirectly) extends Context, there is no getResources() function available.

    So what you need to do is pass along a reference to your application’s context (e.g. in the constructor of your Stego class or similar). Or if all you need is a single resource ID it might be easier to just pass along that ID.

    This could for instance look like this:

    public class Stego()
    {
        Public Stego(Context myAppContext){
            image = BitmapFactory.decodeResource(myAppContext.getResources(), R.drawable.tasnim);
            imWidth  = image.getWidth();
            imHeight = image.getHeight();
        }
    }
    

    From your activity you can then initialize an instance of your Stego class like this:

    Stego stego = new Stego(this);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I my project I have a class that in this class I want to
In the project I'm working on now, we have base Entity class that looks
I have a class library project that references the version 4.1 Microsoft.Practices.Common dll. I
I have a large-ish project that contains one class that reads from a file
I have all my views in a project inheriting from a ViewBase class that
I have a class, which is part of a code library project that was
I have a ConfiguracaoDaApp class in my project that is a NSManagedObject subclass. I
Let's say I have a project that is a class library. I have a
We have two projects that are both class libraries. Project 1 is a VS
I have an RMI server that is using a class from another project. 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.