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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T15:15:50+00:00 2026-05-27T15:15:50+00:00

In my first Activity I’m putting stuff into a Bundle and then firing off

  • 0

In my first Activity I’m putting stuff into a Bundle and then firing off the Intent:

b = new Bundle();
b.putString(Constants.KEY_CLASS, classSelected);
Intent i = new Intent(this, AssessmentMarksActivity.class);
i.putExtras(b);
startActivity(i);

In the next Activity, I just get what I need from it:

tvClass = (TextView) findViewById(R.id.tvAssessmentClass);
b = getIntent().getExtras();
classSelected = b.getString(Constants.KEY_CLASS);
tvClass.setText(classSelected);

I get a NPE when I try to set the text of the TextView.

This is the XML for the Text View:

<TextView
android:id="@+id/tvAssessmentMarksClass"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="left"
android:text="Class"
android:textSize="20dp" />
  • 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-27T15:15:51+00:00Added an answer on May 27, 2026 at 3:15 pm
    tvClass = (TextView) findViewById(R.id.tvAssessmentClass);
    

    Seems the ids are not the same, thus causing your NPE.

    <TextView
        android:id="@+id/tvAssessmentMarksClass"
        ...
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

first activity: String s=create_newfile; Intent i = new Intent(com.monster.android.Showfile); Bundle extras = new Bundle();
This is my code in my first activity: Intent i = new Intent(this, OtherScreen.class);
I am looking into displaying an activity when the service is first started so
In my App, first it shows a splash screen. After that another activity, then
I'm new to Android. I have two activities. First activity shows selected contact list
I have an activity (first) that starts a new activity (second). If I returned
I want to finish my app calling the first activity with Intent.FLAG_ACTIVITY_CLEAR_TOP and finishing
I have this in my first activity: private AdapterView.OnItemClickListener _itemClickLis = new OnItemClickListener() {
I want to sent intent from one first activity to another. The first activity
In one of my first activity i had a small portion of mapview and

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.