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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T18:43:39+00:00 2026-06-15T18:43:39+00:00

I’m trying to make a drobdown navigation menu so i can move between my

  • 0

I’m trying to make a drobdown navigation menu so i can move between my pages using SherlockFragmentActivity and SerlockListFragment
but every time i’m starting my app it’s give this following error:

java.lang.RuntimeException: Unable to start activity ComponentInfo{com.download.manager/com.download.manager.Main}: java.lang.RuntimeException: Your content must have a ListView whose id attribute is android.R.id.list

this is SherlockFragmentActivity class

public class Main extends SherlockFragmentActivity implements OnNavigationListener{

private static final String KEY_MODELS="models";
private static final String KEY_POSITION="position";
private static final String[] labels= { "All", "Downloads","Completed","Later" };
private CharSequence[] models=new CharSequence[4];
private DownloadList frag=null;
private int lastPosition=-1;  

ActionBar act;
ViewPager myviewpager;
int mSelectedPageIndex=1;
DownloadService downloadservice;
Intent serviceIntent ;


@Override
public void onCreate(Bundle state) {
    super.onCreate(state);
    
    frag=(DownloadList)getSupportFragmentManager().findFragmentById(android.R.id.content);
    if (frag==null) {
        frag=new DownloadList();
        getSupportFragmentManager().beginTransaction().add(android.R.id.content, frag).commit();
      }

    if (state != null) {
        models=state.getCharSequenceArray(KEY_MODELS);
      }
    
    if (downloadservice==null)
        downloadservice= new DownloadService();
    ArrayAdapter<String> nav=null;
    act=getSupportActionBar();
   
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH)
    {
      nav= new ArrayAdapter<String>( act.getThemedContext(),android.R.layout.simple_spinner_item,labels);
    }
    else 
    {
      nav=new ArrayAdapter<String>(this,android.R.layout.simple_spinner_item,labels);
    }
    
    nav.setDropDownViewResource(android.R.layout.simple_list_item_1);
    act.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST);
    act.setDisplayShowTitleEnabled(false);
    act.setHomeButtonEnabled(false);
    
    act.setListNavigationCallbacks(nav, this);
    if (state != null) {
        act.setSelectedNavigationItem(state.getInt(KEY_POSITION));
      }
   
    serviceIntent= new Intent(Main.this,downloadservice.getClass());
    if (startService(serviceIntent)==null)
        startService(serviceIntent);
    
    act.setTitle("");
   
}


@Override
public boolean onCreateOptionsMenu(Menu menu) {
    MenuInflater infalter = getSupportMenuInflater();
    infalter.inflate(R.menu.mymenu, menu);
    
    return true;
}

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    if (item.getItemId()==R.id.sub1)
    {
        AlertDialog.Builder alert = new AlertDialog.Builder(this);
        alert.setTitle("Downlaod New File");
        alert.setMessage("Enter URL");
        final EditText input = new EditText(this);
        alert.setView(input);
input.setText("http://205.196.123.184/ddpha7c5b8lg/616c36j0d1xbztf   /Lecture+ppt+Ch2.ppt");
        alert.setPositiveButton("Ok", new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface dialog, int whichButton) {
                String value = input.getText().toString();
                Log.d("value",value);
            }
        });

        alert.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface dialog, int whichButton) {
            }
        });

        alert.show();
    }   
        
    return super.onOptionsItemSelected(item);
}


@Override
protected void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);
    
}

@Override
public boolean onNavigationItemSelected(int itemPosition, long itemId) {
    lastPosition=itemPosition;
    
    
    
    return false;
}

this is SherlockListFragment class

public  class DownloadList extends SherlockListFragment {
int index=0;
Button downloadButton;
Button pauseButton;
Button resumeButton;
TextView textLink;
TextView progressbar;
DownloadService downloadservice= new DownloadService();
MyAdapter listadapter;
Intent serviceIntent ;
String state;


@Override
public void onCreate(Bundle savedInstanceState) {
    // TODO Auto-generated method stub
    super.onCreate(savedInstanceState);
    getActivity().setContentView(R.layout.downloadlist);
}

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup          
 container,BundlesavedInstanceState) {
    View rootView = inflater.inflate(R.layout.downloadlist, container, false);
    
    
    
    return rootView;
}
int getIndex()
{
    return index;
}
public class MyAdapter extends ArrayAdapter<NewDownload>
{
     private final List<NewDownload> list;
      private final Activity context;
      Thread t;
      
    public MyAdapter(Context context,List<NewDownload> list) {
        super(context, R.layout.list_item,  list);
        this.context = (Activity) context;
        this.list = list;
    }
        @Override
        public View getView(int position, View convertView, ViewGroup parent) {
            LayoutInflater inflater = (LayoutInflater) getActivity().
                                          getSystemService(Context.LAYOUT_INFLATER_SERVICE);
            View row = inflater.inflate(R.layout.list_item, null);

            pauseButton = (Button) row.findViewById(R.id.btn1);
            resumeButton = (Button) row.findViewById(R.id.btn2);
            textLink = (TextView) row.findViewById(R.id.tv1);
            progressbar = (TextView) row.findViewById(R.id.progressBar1);
            
                  textLink.setText(downloadservice.
                                      downloads.get(position).getName());
               progressbar.setBottom(downloadservice.
                                     downloads.get(position).getDownloadedSize());
            progressbar.setTop(downloadservice.
                                      downloads.get(position).getTotalSize());
            
            final int p = position;
            final NewDownload r = list.get(p);
            if (r.state=="downloading")
                {
                    progressbar.setText("DownLoading...");
                    pauseButton.setEnabled(true);
                    resumeButton.setEnabled(false);
                }
            else if (r.state=="pause")
                {
                pauseButton.setEnabled(false);
                resumeButton.setEnabled(true);
                progressbar.setText(r.state);
                }
            pauseButton.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                downloadservice.pause(p);
                setListAdapter(listadapter );

                }
            });
                        
            resumeButton.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
            if (getActivity().startService(serviceIntent)==null)
                        
                      getActivity().startService(serviceIntent);
                downloadservice.resume(p);
                setListAdapter(listadapter );
                }
            });
            
            return row;
        }
}

this is downloadlist.xml

    <ListView
    android:id="@+id/list" xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content" >
</ListView>

this is list_item.XML

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

<TextView
    android:id="@+id/tv1"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_gravity="center_horizontal"
    android:text="File Name" />

<TextView
    android:id="@+id/progressBar1"
    
    android:layout_width="306dp"
    android:layout_height="wrap_content"
     />

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content" >





    <Button
        android:id="@+id/btn1"
        style="?android:attr/buttonStyleSmall"
        android:layout_width="wrap_content"
        android:layout_height="34dp"
        android:layout_gravity="center_horizontal"
        android:text="Pause" />




    <Button
        android:id="@+id/btn2"
        style="?android:attr/buttonStyleSmall"
        android:layout_width="wrap_content"
        android:layout_height="34dp"
        android:layout_gravity="right"
        android:text="Resume" />

</LinearLayout>

</LinearLayout>

So any one can tell me where is my mistake ?

  • 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-15T18:43:40+00:00Added an answer on June 15, 2026 at 6:43 pm

    This error:

    Your content must have a ListView whose id attribute is android.R.id.list
    

    means you must use:

    <ListView
        android:id="@android:id/list"
        ...
    

    in download.xml.

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

Sidebar

Related Questions

I'm new to using the Perl treebuilder module for HTML parsing and can't figure
I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
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
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
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
I want to count how many characters a certain string has in PHP, but
I am reading a book about Javascript and jQuery and using one of the
Seemingly simple, but I cannot find anything relevant on the web. What is the

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.