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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T08:38:36+00:00 2026-06-10T08:38:36+00:00

when i try to set the text of an textview i get a nullpointerexception.

  • 0

when i try to set the text of an textview i get a nullpointerexception. somehow the findviewbyid method return null but i dont know why.

this is my xml file:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content" >

<RelativeLayout
    android:id="@+id/rl_ros_layout1"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_alignParentTop="true" >

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_alignParentTop="true"
        android:text="@+id/tv_ros_view1"
        android:textAppearance="?android:attr/textAppearanceMedium" />

    <ProgressBar
        android:id="@+id/pb_ros_bar1"
        style="?android:attr/progressBarStyleSmall"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentRight="true"
        android:layout_alignParentTop="true"
        android:visibility="invisible" />
</RelativeLayout>

<ScrollView
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_below="@+id/rl_ros_layout1" >

    <TableLayout
        android:id="@+id/tl_rostertable"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical"
        android:stretchColumns="2" >

        <TableRow
            android:layout_width="fill_parent"
            android:layout_height="wrap_content" >

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:padding="3dp"
                android:text="@string/team" />

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:padding="3dp"
                android:text="@string/pos" />

            <TextView
                android:layout_height="wrap_content"
                android:padding="3dp"
                android:text="@string/name" />

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="right"
                android:padding="3dp"
                android:text="@string/score" />
        </TableRow>
    </TableLayout>
</ScrollView>
</RelativeLayout>

and my oncreate method

public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.roster);
    final Bundle extra = getIntent().getExtras();
    position = extra.getInt("pos");
    int id = de.damps.fantasy.HomeActivity.ID[position];
    url = de.damps.fantasy.HomeActivity.URL + "/roster/2011/" + id;
    tbl = (TableLayout) findViewById(R.id.tl_rostertable);
    team = (TextView) findViewById(R.id.tv_ros_view1);
    String  s= de.damps.fantasy.HomeActivity.TEAMS[position];
    team.setText(s);

    new GetRoster().execute(url);
}

the tablelayout is found without any problmes. but the textview is null.
i already cleaned the project but it didnt solve the problem

would be nice if someone can help me

  • 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-06-10T08:38:38+00:00Added an answer on June 10, 2026 at 8:38 am

    You have a typo:

       <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_alignParentTop="true"
        android:id="@+id/tv_ros_view1"
        android:textAppearance="?android:attr/textAppearanceMedium" />
    

    (android:text instead of android:id)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is the error i get each time i try and set the LayoutParam's
my problem is that when i try to set the text of service1 and
try to set host in dsn of pdo like this: <?php /* Connect to
I try to set friendship to method from class GameSimulator on Player class. for
In this opportunity I try to do a simple activity that get a EditText
I am trying to Set Location but getting NullPointerException , i have Provided android.permission.ACCESS_COARSE_LOCATION
I try in following way but I am getting Null Pointer Exception at iv.setImageBitmap(bm).
I'm following this example to parse a xml example but when I try to
Why is the following code giving an exception? function SetText(index, text) { try {
I try to set a timeout on an element, fired with a jQuery plugin.

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.