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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T20:36:55+00:00 2026-06-11T20:36:55+00:00

i’m trying to make a webview and listview in a same activity. i have

  • 0

i’m trying to make a webview and listview in a same activity. i have a list view with id list_xc but in a logcat show in my content must have a ListView whose id attribute is 'android.R.id.list.
here’s my layout file :

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

<TextView
    android:id="@+id/tv_xc"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_marginLeft="8dp"
    android:layout_marginTop="3dp"
    android:text="Cross Country (XC)"
    android:textColor="#372c24"
    android:textSize="20dp"
    android:textStyle="bold" />

<WebView
    android:id="@+id/webview_xc"
    android:layout_width="match_parent"
    android:layout_height="166dp" />

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

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" >

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

and here’s my activity :

public class Information_XC_Activity extends ListActivity {
WebView mWebView;
TextView tv;
private Adapter_DetailPolXC adapterDetailPolXC;

private ListView mainListView;

// private ArrayAdapter<String> listAdapter;

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

    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.webview_xc);

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

    ArrayList<Entity_Detail_Product> arraylist = new ArrayList<Entity_Detail_Product>();

    adapterDetailPolXC = new Adapter_DetailPolXC(this, R.layout.info_row,
            arraylist);

    mainListView = (ListView) findViewById(R.id.list_xc);
    mainListView.setAdapter(adapterDetailPolXC);

    new info_xc_dao(response).view_pol_xc();
}

pol_xc_Result response = new pol_xc_Result() {
    @Override
    public void gotResult(Object obj, String message, int action) {
        // TODO Auto-generated method stub
        // actionBar.setProgressBarVisibility(View.INVISIBLE);

        @SuppressWarnings("unchecked")
        ArrayList<Entity_Detail_Product> arrayList = (ArrayList<Entity_Detail_Product>) obj;
        AlertDialog.Builder builder = new AlertDialog.Builder(
                Information_XC_Activity.this);

        if (arrayList == null) {
            builder.setIcon(R.drawable.alert_warning);
            builder.setTitle("Error");
            builder.setMessage("Data Not Found !");
            builder.setNegativeButton("Ok",
                    new DialogInterface.OnClickListener() {
                        public void onClick(DialogInterface dialog,
                                int which) {
                        }
                    });
            AlertDialog alert = builder.create();
            alert.show();

        } else {
            for (Entity_Detail_Product entity_Detail_Product : arrayList) {
                adapterDetailPolXC.add(entity_Detail_Product);
            }
            adapterDetailPolXC.notifyDataSetChanged();
        }

    }

};

private class Adapter_DetailPolXC extends
        ArrayAdapter<Entity_Detail_Product> {
    private ArrayList<Entity_Detail_Product> items;

    public Adapter_DetailPolXC(Context context, int textViewResourceId,
            ArrayList<Entity_Detail_Product> items) {
        super(context, textViewResourceId, items);
        this.items = items;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        // TODO Auto-generated method stub
        View v = convertView;
        if (v == null) {
            LayoutInflater layoutInflater = (LayoutInflater) getContext()
                    .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
            v = (View) layoutInflater.inflate(R.layout.info_xc, null);
        }
        Entity_Detail_Product adapter_Detail_Product = items.get(position);
        if (adapter_Detail_Product != null) {
            TextView textView = (TextView) v.findViewById(R.id.tv_test);
            if (textView != null)
                textView.setText(adapter_Detail_Product.getModel_name());
        }
        return v;
    }

}

and here’s the logcat :

09-21 03:22:49.029: E/AndroidRuntime(22732): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.wilis.hellotabwidget/com.wilis.hellotabwidget.Information_XC_Activity}: java.lang.RuntimeException: Your content must have a ListView whose id attribute is ‘android.R.id.list’
09-21 03:22:49.029: E/AndroidRuntime(22732): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1651)
09-21 03:22:49.029: E/AndroidRuntime(22732): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1667)
09-21 03:22:49.029: E/AndroidRuntime(22732): at android.app.ActivityThread.access$1500(ActivityThread.java:117)
09-21 03:22:49.029: E/AndroidRuntime(22732): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:935)
09-21 03:22:49.029: E/AndroidRuntime(22732): at android.os.Handler.dispatchMessage(Handler.java:99)
09-21 03:22:49.029: E/AndroidRuntime(22732): at android.os.Looper.loop(Looper.java:130)
09-21 03:22:49.029: E/AndroidRuntime(22732): at android.app.ActivityThread.main(ActivityThread.java:3687)
09-21 03:22:49.029: E/AndroidRuntime(22732): at java.lang.reflect.Method.invokeNative(Native Method)
09-21 03:22:49.029: E/AndroidRuntime(22732): at java.lang.reflect.Method.invoke(Method.java:507)
09-21 03:22:49.029: E/AndroidRuntime(22732): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:867)
09-21 03:22:49.029: E/AndroidRuntime(22732): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:625)
09-21 03:22:49.029: E/AndroidRuntime(22732): at dalvik.system.NativeStart.main(Native Method)
09-21 03:22:49.029: E/AndroidRuntime(22732): Caused by: java.lang.RuntimeException: Your content must have a ListView whose id attribute is ‘android.R.id.list’
09-21 03:22:49.029: E/AndroidRuntime(22732): at android.app.ListActivity.onContentChanged(ListActivity.java:243)
09-21 03:22:49.029: E/AndroidRuntime(22732): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:212)
09-21 03:22:49.029: E/AndroidRuntime(22732): at android.app.Activity.setContentView(Activity.java:1657)
09-21 03:22:49.029: E/AndroidRuntime(22732): at com.wilis.hellotabwidget.Information_XC_Activity.onCreate(Information_XC_Activity.java:35)
09-21 03:22:49.029: E/AndroidRuntime(22732): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
09-21 03:22:49.029: E/AndroidRuntime(22732): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1615)

thankyou so much, i really need help.

  • 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-11T20:36:56+00:00Added an answer on June 11, 2026 at 8:36 pm

    ListActivity does not require that you assign a layout to it via the setContentView() method, if you only want to show a ListView ListActivity contains by default a ListView.

    In case you need to include more Views than a ListView in your ListActivity you can still assign a layout to your Activity. In this case your layout must contain a ListView with the android:id attribute set to @android:id/list. so modify code to this.

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

    If you use a View with the @android:id/empty ID in your layout, ListActivity will automatically show this View if the ListView is empty and hide it otherwise.

    • 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 have a French site that I want to parse, but am running into
This could be a duplicate question, but I have no idea what search terms
I have an MVC Razor view @{ ViewBag.Title = Index; var c = (char)146;
I have a view passing on information from a database: def serve_article(request, id): served_article
I am trying to loop through a bunch of documents I have to put
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 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

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.