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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T15:42:50+00:00 2026-06-11T15:42:50+00:00

i’m trying to make a webview and listview in a same activity. here’s my

  • 0

i’m trying to make a webview and listview in a same activity.
here’s my layout file :

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="@android:color/white" >

<com.markupartist.android.widget.ActionBar
    android:id="@+id/actionbar"
    style="@style/ActionBar" />

<WebView
    android:id="@+id/webView1"
    android:layout_width="match_parent"
    android:layout_height="210dp" />

<ListView
    android:id="@+id/listtest"
    android:layout_width="match_parent"
    android:layout_height="wrap_content" >
</ListView>

<TextView 
    android:id="@+id/tv_test2"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:padding="10dp"
    android:textSize="16sp"/>

and here’s my row layout :

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/white"
android:orientation="vertical" >

<com.markupartist.android.widget.ActionBar
    android:id="@+id/actionbar"
    style="@style/ActionBar" />

<TextView
    android:id="@+id/tv_test"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:padding="10dp"
    android:textSize="16sp" >
</TextView>

and here’s my activity :

public class Tab_Bike_Information_Activity extends Activity {
WebView mWebView;
TextView tv;
private ListView mainListView;
private ArrayAdapter<String> listAdapter;

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.tessss);

    final ActionBar actionBar = (ActionBar) findViewById(R.id.actionbar);
    actionBar.setTitle(getString(R.string.app_name));

    int index = getIntent().getIntExtra("text", 0);

    mWebView = (WebView) findViewById(R.id.webView1);

    String temp = "<html><body>" + "<p align=\"justify\">"
            + getString(R.string.xc_info + index) + "</p> "
            + "</body></html>";
    mWebView.loadData(temp, "text/html", "utf-8");


    mainListView = (ListView) findViewById(android.R.id.list );  

    // Create and populate a List of planet names.  
    String[] planets = new String[] { "Mercury", "Venus", "Earth", "Mars",  
                                      "Jupiter", "Saturn", "Uranus", "Neptune"};    
    ArrayList<String> planetList = new ArrayList<String>();  
    planetList.addAll( Arrays.asList(planets) );  

    // Create ArrayAdapter using the planet list.  
    listAdapter = new ArrayAdapter<String>(this, R.layout.tessss_row, planetList);  

    // Add more planets. If you passed a String[] instead of a List<String>   
    // into the ArrayAdapter constructor, you must not add more items.   
    // Otherwise an exception will occur.  
    listAdapter.add( "Ceres" );  
    listAdapter.add( "Pluto" );  
    listAdapter.add( "Haumea" );  
    listAdapter.add( "Makemake" );  
    listAdapter.add( "Eris" );  


    tv = (TextView) findViewById(R.id.tv_test);

}

and here’s the logcat :

09-19 20:04:04.659: E/AndroidRuntime(13951): FATAL EXCEPTION: main
09-19 20:04:04.659: E/AndroidRuntime(13951): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.wilis.hellotabwidget/com.wilis.hellotabwidget.Tab_Bike_Information_Activity}: java.lang.NullPointerException
09-19 20:04:04.659: E/AndroidRuntime(13951):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1651)
09-19 20:04:04.659: E/AndroidRuntime(13951):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1667)
09-19 20:04:04.659: E/AndroidRuntime(13951):    at android.app.ActivityThread.access$1500(ActivityThread.java:117)
09-19 20:04:04.659: E/AndroidRuntime(13951):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:935)
09-19 20:04:04.659: E/AndroidRuntime(13951):    at android.os.Handler.dispatchMessage(Handler.java:99)
09-19 20:04:04.659: E/AndroidRuntime(13951):    at android.os.Looper.loop(Looper.java:130)
09-19 20:04:04.659: E/AndroidRuntime(13951):    at android.app.ActivityThread.main(ActivityThread.java:3687)
09-19 20:04:04.659: E/AndroidRuntime(13951):    at java.lang.reflect.Method.invokeNative(Native Method)
09-19 20:04:04.659: E/AndroidRuntime(13951):    at java.lang.reflect.Method.invoke(Method.java:507)
09-19 20:04:04.659: E/AndroidRuntime(13951):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:867)
09-19 20:04:04.659: E/AndroidRuntime(13951):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:625)
09-19 20:04:04.659: E/AndroidRuntime(13951):    at dalvik.system.NativeStart.main(Native Method)
09-19 20:04:04.659: E/AndroidRuntime(13951): Caused by: java.lang.NullPointerException
09-19 20:04:04.659: E/AndroidRuntime(13951):    at com.wilis.hellotabwidget.Tab_Bike_Information_Activity.onCreate(Tab_Bike_Information_Activity.java:75)
09-19 20:04:04.659: E/AndroidRuntime(13951):    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
09-19 20:04:04.659: E/AndroidRuntime(13951):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1615)
09-19 20:04:04.659: E/AndroidRuntime(13951):    ... 11 more

can anybody help with this? thanks

  • 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-11T15:42:51+00:00Added an answer on June 11, 2026 at 3:42 pm

    I see two Problems: First the ID of your listview.
    Change

    mainListView = (ListView) findViewById(android.R.id.list );
    

    to

    mainListView = (ListView) findViewById(R.id.listtest );
    

    maybe you need to delete the import for android.R.* to make eclipse recognize the change.

    Second, in your adapter there is now TextView specified.
    Change

    listAdapter = new ArrayAdapter<String>(this, R.layout.tessss_row, planetList);
    

    to

    listAdapter = new ArrayAdapter<String>(this, R.layout.tessss_row, R.id.tv_test, planetList);
    

    to let the ArrayAdapter know in which textView it should write the content of planetList.

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

Sidebar

Related Questions

I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
I am trying to render a haml file in a javascript response like so:
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I want use html5's new tag to play a wav file (currently only supported
In my XML file chapters tag has more chapter tag.i need to display chapters

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.