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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T01:01:02+00:00 2026-05-27T01:01:02+00:00

I have a listview extends Activity and use custom adapter because I want icon

  • 0

I have a listview extends Activity and use custom adapter because I want icon and text on the listview.

String[] options = res.getStringArray(R.array.menu_title);
    TypedArray icons = res.obtainTypedArray(R.array.menu_icon);
    ImageAndTextAdapter iadapter = new ImageAndTextAdapter(ctx, R.layout.row, options, icons);
    MenuList.setAdapter(iadapter);

Then I use the setOnItemClickListener to make the listview clickable but fail.

MenuList.setOnItemClickListener(new ListView.OnItemClickListener() {
        public void onItemClick(AdapterView<?> arg0, View v, int position, long id) {
            Intent myIntent = new Intent(Menu.this, Revision.class);    
            Menu.this.startActivity(myIntent);
            }
    }); 

Here is the logcat:

11-22 16:55:17.419: E/AndroidRuntime(2056): FATAL EXCEPTION: main
11-22 16:55:17.419: E/AndroidRuntime(2056):
java.lang.ClassCastException: android.widget.LinearLayout 11-22
16:55:17.419: E/AndroidRuntime(2056): at
cs.ucl.cw.Menu$1.onItemClick(Menu.java:54) 11-22 16:55:17.419:
E/AndroidRuntime(2056): at
android.widget.AdapterView.performItemClick(AdapterView.java:284)
11-22 16:55:17.419: E/AndroidRuntime(2056): at
android.widget.ListView.performItemClick(ListView.java:3513) 11-22
16:55:17.419: E/AndroidRuntime(2056): at
android.widget.AbsListView$PerformClick.run(AbsListView.java:1849)
11-22 16:55:17.419: E/AndroidRuntime(2056): at
android.os.Handler.handleCallback(Handler.java:587) 11-22
16:55:17.419: E/AndroidRuntime(2056): at
android.os.Handler.dispatchMessage(Handler.java:92) 11-22
16:55:17.419: E/AndroidRuntime(2056): at
android.os.Looper.loop(Looper.java:130) 11-22 16:55:17.419:
E/AndroidRuntime(2056): at
android.app.ActivityThread.main(ActivityThread.java:3835) 11-22
16:55:17.419: E/AndroidRuntime(2056): at
java.lang.reflect.Method.invokeNative(Native Method) 11-22
16:55:17.419: E/AndroidRuntime(2056): at
java.lang.reflect.Method.invoke(Method.java:507) 11-22 16:55:17.419:
E/AndroidRuntime(2056): at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:847)
11-22 16:55:17.419: E/AndroidRuntime(2056): at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:605) 11-22
16:55:17.419: E/AndroidRuntime(2056): at
dalvik.system.NativeStart.main(Native Method)

AIM:
clickable listview which would bring up other activities. Thanks guys

  • 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-05-27T01:01:02+00:00Added an answer on May 27, 2026 at 1:01 am

    It appears that your problem might actually be in Revision.class. Without seeing that code, i cant say for sure, but the part of the Logcat that points to that would be:

     java.lang.ClassCastException: android.widget.LinearLayout
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a ListView with a custom Adapter that extends ArrayAdapter. It's a ArrayAdapter
I have an activity that extends ListView. I populate my list with the results
I have some problems with my custom adapter for a ListView . I'm unsure
I have a activity that fills a ListView, and it is working. Because I
I have a custom ArrayAdapter I use to manage my ListView: public class FilesAdapter
I have a activity displaying call logs in a ListView. The adapter used here
I have a ListView with Horizontal WrapPanel as its ItemsPanelTemplate. I want to get
I want to use a list view and I have created my own layout
I have an activity that extends ListActivity and implementsOnScrollListener: public class RecentItemsList extends GenericListActivity
I have a custom ArrayAdapter populating a ListView . Here it is: public class

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.