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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T06:06:11+00:00 2026-06-06T06:06:11+00:00

I’m adapting an old WebOS app to android and I’m using phonegap for nearly

  • 0

I’m adapting an old WebOS app to android and I’m using phonegap for nearly all of it (since the old code was javascript, this is convenient), but I wish to use a native AutoCompleteTextView for input. I’m getting a NullPointerException, probably due to my exotic hybrid app. But let me start at the beginning. I appended a footer (per a post I found here) like so

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    super.loadUrl("file:///android_asset/www/index.html");

    /* ... boring things here ... */

    // http://stackoverflow.com/questions/7320910/android-phonegap-with-native-controls
        View footer = View.inflate(getContext(), R.layout.footer, null);
        root.addView( footer );

    // setContentView(root);
    // http://www.kwpro.net/blogs/2011/1/10/1651_Android_AutoComplete_Tutorial_Amendment.html        
}   

I found some notes on a blog that suggested the solution to my problem might be to setContentView, but that doesn’t seem to work. Anyway, I set the autocomplete text exactly once from javascript using this (via window.f.setAutoComplete() through a java interface).

public void setAutoComplete(String []s) {
    Log.d(TAG, "[native]: setting autocomplete text");

    AutoCompleteTextView textView = (AutoCompleteTextView) findViewById(R.id.inpu);
    ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, R.layout.list_item, s);
    textView.setAdapter(adapter);
}

Anyway, everything seems to work. That is, the list of choices pops up and you can sometimes pick one (sometimes) before I get a NullPointerException that force closes the app. I feel ill equipped to deal with this one, so I thought I’d ask in public.

The exception dump looks like this:

W/dalvikvm( 1832): threadid=11: thread exiting with uncaught exception (group=0x409c01f8)
E/AndroidRuntime( 1832): FATAL EXCEPTION: WebViewCoreThread
E/AndroidRuntime( 1832): java.lang.NullPointerException
E/AndroidRuntime( 1832):        at android.widget.AbsListView$RecycleBin.getScrapView(AbsListView.java:5900)
E/AndroidRuntime( 1832):        at android.widget.AbsListView.obtainView(AbsListView.java:2003)
E/AndroidRuntime( 1832):        at android.widget.ListPopupWindow$DropDownListView.obtainView(ListPopupWindow.java:1168)
E/AndroidRuntime( 1832):        at android.widget.ListView.measureHeightOfChildren(ListView.java:1244)
E/AndroidRuntime( 1832):        at android.widget.ListPopupWindow.buildDropDown(ListPopupWindow.java:1095)
E/AndroidRuntime( 1832):        at android.widget.ListPopupWindow.show(ListPopupWindow.java:524)
E/AndroidRuntime( 1832):        at android.widget.AutoCompleteTextView.showDropDown(AutoCompleteTextView.java:1062)
E/AndroidRuntime( 1832):        at android.widget.AutoCompleteTextView.updateDropDownForFilter(AutoCompleteTextView.java:939)
E/AndroidRuntime( 1832):        at android.widget.AutoCompleteTextView.onFilterComplete(AutoCompleteTextView.java:921)
E/AndroidRuntime( 1832):        at android.widget.Filter$ResultsHandler.handleMessage(Filter.java:285)
E/AndroidRuntime( 1832):        at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime( 1832):        at android.os.Looper.loop(Looper.java:137)
E/AndroidRuntime( 1832):        at android.webkit.WebViewCore$WebCoreThread.run(WebViewCore.java:728)
E/AndroidRuntime( 1832):        at java.lang.Thread.run(Thread.java:856)

My best guess is that I’m running into that “only one thread can do UI stuff” … ahh … paradigm, but I’m not sure how to approach fixing that if that’s the case, and if that’s not the case, I have no idea what to try next.

  • 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-06T06:06:12+00:00Added an answer on June 6, 2026 at 6:06 am

    Never did get a response on this, but in case anyone else runs into it… The auto complete choices are part of the ui, so you have to ask the ui to update it. Pretty simple really. I had surmised it in the question itself, but didn’t reason it out all the way.

    public void setAutoComplete(String []s) {
        Log.d(TAG, "[native]: setting autocomplete text");
    
        autoCompleteArray = s;
    
        handler.post(new Runnable() {
            public void run() {
                hist.clear();
                for(int i=0; i<autoCompleteArray.length; i++)
                    hist.add(autoCompleteArray[i]);
                hist.notifyDataSetChanged();
            }
        });
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I am reading a book about Javascript and jQuery and using one of the
I have this code to decode numeric html entities to the UTF8 equivalent character.
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
We're building an app, our first using Rails 3, and we're having to build
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I am using Paperclip to handle profile photo uploads in my app. They upload
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
For some reason, after submitting a string like this Jack’s Spindle from a text

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.