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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T18:34:34+00:00 2026-06-07T18:34:34+00:00

Here is my problem, I am trying to setText from a ListView. The problem

  • 0

Here is my problem, I am trying to setText from a ListView. The problem is, I will get an error because (according to my logs) the setContentView of my main activity does not match up with the TextView i want to setText from another .xml (contactList.xml)

Jobs Activity (Main)

 @Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.jobs);
    vib = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE);
    TextView assigned = (TextView) findViewById(R.id.assigned);



    new ParseJobs().execute();

ParseJobs() Method

    @Override
    protected void onPostExecute(Void result) {
        super.onPostExecute(result);



        if (ACKNOWLEDGED.contains("False")) {


            /** Updating parsed JSON data into ListView */
            ListAdapter adapter = new SimpleAdapter(Jobs.this, contactList, R.layout.list_item, new String[] { job, pays, ready_at }, new int[] { R.id.job1, R.id.pays1, R.id.ready_at1 });
            setListAdapter(adapter);        

            //TextView readyORdue = (TextView) findViewById(R.id.readyORdue);
            //readyORdue.setText("Ready At:");
        }

        if (ACKNOWLEDGED.contains("True")) {

            /** Updating parsed JSON data into ListView */
            ListAdapter adapter = new SimpleAdapter(Jobs.this, contactList, R.layout.list_item, new String[] { job, pays, due_by }, new int[] { R.id.job1, R.id.pays1, R.id.due_by1 });
            setListAdapter(adapter);    

            //TextView readyORdue = (TextView) findViewById(R.id.readyORdue);
            //readyORdue.setText("Due By:");
        }


        VerifyDriver.dismiss();

    }
}

Notice in my ParseJobs Method, I am trying to to update the TextView “readyORdue” but I will get an error because, that TextView belongs to SimpleAdapter contactList.xml

So my question is, how would i setText a textview from my contactList XML layout?

Heres My Logs:

 07-17 15:55:16.703: W/dalvikvm(4387): threadid=1: thread exiting with uncaught exception (group=0x40015578)
 07-17 15:55:16.703: E/AndroidRuntime(4387): FATAL EXCEPTION: main
 07-17 15:55:16.703: E/AndroidRuntime(4387): java.lang.NullPointerException
 07-17 15:55:16.703: E/AndroidRuntime(4387):    at com.jetdelivery.mobile.Jobs$ParseJobs.onPostExecute(Jobs.java:287)
 07-17 15:55:16.703: E/AndroidRuntime(4387):    at com.jetdelivery.mobile.Jobs$ParseJobs.onPostExecute(Jobs.java:1)
 07-17 15:55:16.703: E/AndroidRuntime(4387):    at android.os.AsyncTask.finish(AsyncTask.java:417)
 07-17 15:55:16.703: E/AndroidRuntime(4387):    at android.os.AsyncTask.access$300(AsyncTask.java:127)
 07-17 15:55:16.703: E/AndroidRuntime(4387):    at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:429)
 07-17 15:55:16.703: E/AndroidRuntime(4387):    at android.os.Handler.dispatchMessage(Handler.java:99)
 07-17 15:55:16.703: E/AndroidRuntime(4387):    at android.os.Looper.loop(Looper.java:130)
 07-17 15:55:16.703: E/AndroidRuntime(4387):    at android.app.ActivityThread.main(ActivityThread.java:3687)
 07-17 15:55:16.703: E/AndroidRuntime(4387):    at java.lang.reflect.Method.invokeNative(Native Method)
 07-17 15:55:16.703: E/AndroidRuntime(4387):    at java.lang.reflect.Method.invoke(Method.java:507)
07-17 15:55:16.703: E/AndroidRuntime(4387):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:842)
07-17 15:55:16.703: E/AndroidRuntime(4387):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:600)
07-17 15:55:16.703: E/AndroidRuntime(4387):     at dalvik.system.NativeStart.main(Native Method)

Line 287 is “readyORdue.setText(“Ready At:”);”

  • 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-07T18:34:36+00:00Added an answer on June 7, 2026 at 6:34 pm

    If you want to use another layout file “contactList.xml” as you described, first you need to inflate it.

    LayoutInflater inflater = (LayoutInflater)context.getSystemService (Context.LAYOUT_INFLATER_SERVICE); 
    View contactList= inflater.inflate(R.layout.contactList, false);
    

    Now

    TextView readyORdue = (TextView)contactList.findViewById(R.id.readyORdue);
    

    will give you needed TextView, add this view to some container in your R.layout.jobs to make it visible.

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

Sidebar

Related Questions

So Here is the Problem, I am trying to get that circle to align
So here is my problem, I'm trying to get the content of a text
I am trying to delete the selected item from a ListView and the Problem
Hey I got a problem here. I'm trying to retrieve the date from the
Here is a problem I am trying to solve: I have an irregular shape.
Here's my problem - I'm trying to access a session namespace across actions .
Here's my problem: I'm trying to set up a simple mobile contact form with
I'm trying to solve the problem here but I don't know why my code
I have an interesting problem here I've been trying to solve for the last
I am stuck with a small problem here.. What i am trying to do

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.