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

  • Home
  • SEARCH
  • 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 3451230
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T09:07:27+00:00 2026-05-18T09:07:27+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 that I don’t know how should I address this picture. My picture is in drawable folder. The code that I have written is, the problem is image = (ImageView)findViewById(R.id.imViewRaw); :

import android.view.View;
import android.widget.ImageView;


public class Stego
{
    private ImageView image;
    private int imWidth, imHeight;

    public Stego()
    {
        // Instantiate an ImageView and define its properties
        image = (ImageView)findViewById(R.id.imViewRaw);
        image.setImageResource(R.drawable.tasnim);
        imWidth  = image.getWidth();
        imHeight = image.getHeight();
    }

    public int getImageWidth(){
        return imWidth;
    }

    public int getImageHeight(){
        return imHeight;
    }

    public int getMaxMessageChars(){
        int i = imWidth * imHeight; //Number of Pixels
        i *= 3; //Number of bytes. (Each pixel includes of three RGB bytes)
        i /= 4; //Maximum number of characters to store in the picture

        return i;
    }
}
  • 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-18T09:07:28+00:00Added an answer on May 18, 2026 at 9:07 am

    Image that is stored in your application resources you can fully process via android.graphics.Bitmap

        Bitmap image = BitmapFactory.decodeResource(this.getResources(), R.drawable.tasnim);
        imWidth = image.getWidth();
        imHeight = image.getHeight();
    
    • 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.