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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T03:13:57+00:00 2026-06-04T03:13:57+00:00

Here is my code : This is my handleMessage Function : public void handleMessage(Message

  • 0

Here is my code :
This is my handleMessage Function :

 public void handleMessage(Message msg)
                   {
                       if(msg.what==1){
                      ArrayList<pack.Form> o=(ArrayList<pack.Form>)msg.obj;
                      pb.setVisibility(8);try{

                      showList(o);
                      }catch(Exception e)
                      {
                          Toast.makeText(getApplicationContext(), e.toString(), Toast.LENGTH_LONG).show();
                      }
}

This is my showList function :

public  void showList(ArrayList<Form> v)
       {
           try{ListView listView = (ListView) ListActivity.this.findViewById(R.id.mylist);
            listView.setTextFilterEnabled(true);
             String[] values=new String[200];
             int i=0;
            Iterator<Form> it=v.listIterator();
            while(it.hasNext())
            {
                values[i]=((Form)it.next()).body;
            }
            ArrayAdapter<String> adapter = new ArrayAdapter<String>(context,
                    R.layout.list_item,values);

                // Assign adapter to ListView
                listView.setAdapter(adapter);}
           catch(Exception e){Toast.makeText(getApplicationContext(), e.toString(), Toast.LENGTH_LONG).show();}
       }

A null ponter exception is being thrown when showList() function is being called. What is the problem?
Logcat Output :

D/AndroidRuntime(  914): Shutting down VM
W/dalvikvm(  914): threadid=3: thread exiting with uncaught exception (group=0x4
001b188)
E/AndroidRuntime(  914): Uncaught handler: thread main exiting due to uncaught e
xception
E/AndroidRuntime(  914): java.lang.NullPointerException
E/AndroidRuntime(  914):        at android.widget.ArrayAdapter.createViewFromRes
ource(ArrayAdapter.java:355)
E/AndroidRuntime(  914):        at android.widget.ArrayAdapter.getView(ArrayAdap
ter.java:323)
E/AndroidRuntime(  914):        at android.widget.AbsListView.obtainView(AbsList
View.java:1256)
E/AndroidRuntime(  914):        at android.widget.ListView.measureHeightOfChildr
en(ListView.java:1147)
E/AndroidRuntime(  914):        at android.widget.ListView.onMeasure(ListView.ja
va:1060)
E/AndroidRuntime(  914):        at android.view.View.measure(View.java:7964)
E/AndroidRuntime(  914):        at android.view.ViewGroup.measureChildWithMargin
s(ViewGroup.java:3023)
E/AndroidRuntime(  914):        at android.widget.LinearLayout.measureChildBefor
eLayout(LinearLayout.java:888)
E/AndroidRuntime(  914):        at android.widget.LinearLayout.measureVertical(L
inearLayout.java:350)
E/AndroidRuntime(  914):        at android.widget.LinearLayout.onMeasure(LinearL
ayout.java:278)
E/AndroidRuntime(  914):        at android.view.View.measure(View.java:7964)
E/AndroidRuntime(  914):        at android.view.ViewGroup.measureChildWithMargin
s(ViewGroup.java:3023)
E/AndroidRuntime(  914):        at android.widget.FrameLayout.onMeasure(FrameLay
out.java:245)
E/AndroidRuntime(  914):        at android.view.View.measure(View.java:7964)
E/AndroidRuntime(  914):        at android.widget.LinearLayout.measureVertical(L
inearLayout.java:464)
E/AndroidRuntime(  914):        at android.widget.LinearLayout.onMeasure(LinearL
ayout.java:278)
E/AndroidRuntime(  914):        at android.view.View.measure(View.java:7964)
E/AndroidRuntime(  914):        at android.view.ViewGroup.measureChildWithMargin
s(ViewGroup.java:3023)
E/AndroidRuntime(  914):        at android.widget.FrameLayout.onMeasure(FrameLay
out.java:245)
E/AndroidRuntime(  914):        at android.view.View.measure(View.java:7964)
E/AndroidRuntime(  914):        at android.view.ViewRoot.performTraversals(ViewR
oot.java:763)
E/AndroidRuntime(  914):        at android.view.ViewRoot.handleMessage(ViewRoot.
java:1633)
E/AndroidRuntime(  914):        at android.os.Handler.dispatchMessage(Handler.ja
va:99)
E/AndroidRuntime(  914):        at android.os.Looper.loop(Looper.java:123)
E/AndroidRuntime(  914):        at android.app.ActivityThread.main(ActivityThrea
d.java:4363)
E/AndroidRuntime(  914):        at java.lang.reflect.Method.invokeNative(Native
Method)
E/AndroidRuntime(  914):        at java.lang.reflect.Method.invoke(Method.java:5
21)
E/AndroidRuntime(  914):        at com.android.internal.os.ZygoteInit$MethodAndA
rgsCaller.run(ZygoteInit.java:860)
E/AndroidRuntime(  914):        at com.android.internal.os.ZygoteInit.main(Zygot
eInit.java:618)
E/AndroidRuntime(  914):        at dalvik.system.NativeStart.main(Native Method)

I/Process (   52): Sending signal. PID: 914 SIG: 3
I/dalvikvm(  914): threadid=7: reacting to signal 3
E/dalvikvm(  914): Unable to open stack trace file '/data/anr/traces.txt': Permi
ssion denied
I/Process (  914): Sending signal. PID: 914 SIG: 9
I/WindowManager(   52): WIN DEATH: Window{44da9a90 com.list/com.list.ListActivit
y paused=false}
I/ActivityManager(   52): Process com.list (pid 914) has died.
I/UsageStats(   52): Unexpected resume of com.android.launcher while already res
umed in com.list
E/gralloc (   52): [unregister] handle 0x47bf40 still locked (state=40000001)
W/InputManagerService(   52): Got RemoteException sending setActive(false) notif
ication to pid 914 uid 10030
D/dalvikvm(  183): GC freed 28 objects / 1360 bytes in 149ms
  • 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-04T03:13:57+00:00Added an answer on June 4, 2026 at 3:13 am

    It was a very silly mistake. I did not increment the i value in the for loop in showList() function. just adding i++ worked. Sorry for wasting your time.

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

Sidebar

Related Questions

I have this code here: var Person = (function() { var name; var PersonConstructor
Here in this code: $('#doneItem').click(function(){ $(this).each(function(index){ var item = 'personal' + index; alert(item); localStorage.removeItem('personal'
I found this code from here: http://www.cssportal.com/form-elements/text-box.htm But the problem is you can still
I'm sure I'm doing something stupid here, but the following code: ... public void
I have this code here, which is intended to allow any type of arguments:
I have this code here, {foreach from=$cart.cartItems item=item name=cart} <div id=cart2Produkt> <p>{if $item.Product.ID} <a
I found this code here class Usable; class Usable_lock { friend class Usable; private:
so this code here dynamically adds buttons to my wpf windows application. I cant
For some reason my code here (this is the entire thing) doesnt actually render
Ok the error is showing up somewhere in this here code if($error==false) { $query

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.