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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T23:27:04+00:00 2026-05-29T23:27:04+00:00

I have passed my resource ID through intent to another class. I then retrieve

  • 0

I have passed my resource ID through intent to another class. I then retrieve the extra from the intent and store it in an int.

Now I want to get that int to convert into a view or something so that I can use getTag()? I tried assigning it to an ImageView but kept getting NullPointer

Passed:

             int resourceId = v.getId(); 

             Intent intent = new Intent(FetchMenu.this,FetchContent.class);
             intent.putExtra("ResourceId",resourceId);  
             startActivity(intent);       

Received:

             int id;

             Intent callingIntent = getIntent();
             int getView= callingIntent.getIntExtra("ResourceId", 1); 
             id = getView;

This prints to logcat:

System.out.println("Resource ID: " + id);

Logcat:"Resource ID: 2131099660"

This is giving me NullPointer:

             View v = (View)findViewById(id);                

             String str=(String) v.getTag();

             System.out.println("Tag : " + str);

Thanks

  • 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-29T23:27:05+00:00Added an answer on May 29, 2026 at 11:27 pm

    Views are from the type int. So you can put the layout as Extras in an Intent:

    final Intent intent = new Intent(this,Activity2.class);
    intent.putExtra("layout",R.layout.mylayout);
    startActivity(intent);
    

    And then in your Activity2:

    Bundle bundle = getIntent().getExtras();
    final int iLayout = bundle.getInt("layout");
    setContentView(iLayout);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a resource handler that is Response.WriteFile(fileName) based on a parameter passed through
I have some messages being passed back from my server through php. The problem
I have some data passed into the flex via webservices, and want to create
I have an array of values that is passed to my function from a
I have a TextBox whose value is passed to an int property in an
I have a Uri object being passed to a constructor of my class. I
I have passed the last couple of hours trying to downgrade Java to 1.6.0_13
I have been passed a date string that looks like this: Thu%20Mar%2011%202010%2015%3A09%3A11%20GMT%2B0000%20(BST) I want
Hi I'm very new to sql but have been passed a job in which
I have a list of bean objects passed into my JSP page, and one

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.