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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T02:10:44+00:00 2026-06-06T02:10:44+00:00

I have a custom listview, i successfully parse the data into a list but

  • 0

I have a custom listview, i successfully parse the data into a list but when i try using a onclick the app crashes, help?

Main Activity

public class CustomizedListView extends Activity {
// All static variables
static final String URL = "http://dl.dropbox.com/u/48258247/music.xml";
// XML node keys
static final String KEY_SONG = "song"; // parent node
static final String KEY_ID = "id";
static final String KEY_TITLE = "title";
static final String KEY_ARTIST = "artist";
static final String KEY_DURATION = "duration";
static final String KEY_THUMB_URL = "thumb_url";

ListView list;
LazyAdapter adapter;

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


    ArrayList<HashMap<String, String>> songsList = new ArrayList<HashMap<String, String>>();

    XMLParser parser = new XMLParser();
    String xml = parser.getXmlFromUrl(URL); // getting XML from URL
    Document doc = parser.getDomElement(xml); // getting DOM element

    NodeList nl = doc.getElementsByTagName(KEY_SONG);
    // looping through all song nodes <song>
    for (int i = 0; i < nl.getLength(); i++) {
        // creating new HashMap
        HashMap<String, String> map = new HashMap<String, String>();
        Element e = (Element) nl.item(i);
        // adding each child node to HashMap key => value
        map.put(KEY_ID, parser.getValue(e, KEY_ID));
        map.put(KEY_TITLE, parser.getValue(e, KEY_TITLE));
        map.put(KEY_ARTIST, parser.getValue(e, KEY_ARTIST));
        map.put(KEY_DURATION, parser.getValue(e, KEY_DURATION));
        map.put(KEY_THUMB_URL, parser.getValue(e, KEY_THUMB_URL));

        // adding HashList to ArrayList
        songsList.add(map);
    }


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

    // Getting adapter by passing xml data ArrayList
    adapter=new LazyAdapter(this, songsList);        
    list.setAdapter(adapter);


    // Click event for single list row


    list.setOnItemClickListener(new OnItemClickListener() {

        public void onItemClick(AdapterView<?> parent, View view,
                int position, long id) {
            // getting values from selected ListItem
            String song = ((TextView) view.findViewById(R.id.title)).getText().toString();
            String artist = ((TextView) view.findViewById(R.id.artist)).getText().toString();
            String thumb_url = ((TextView) view.findViewById(R.id.duration)).getText().toString();

            // Starting new intent
            Intent in = new Intent(getApplicationContext(), SingleMenuItem.class);
            in.putExtra(KEY_SONG, song);
            in.putExtra(KEY_ARTIST, artist);
            in.putExtra(KEY_THUMB_URL, thumb_url);
            startActivity(in);

        }
    });     
}   
}

SingleMenuItemActivity

package com.example.androidhive;

import org.scouts.android.R;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.widget.TextView;

public class SingleMenuItem  extends Activity {

// XML node keys
static final String KEY_SONG = "song";
static final String KEY_ARTIST = "artist";
static final String KEY_THUMB_URL = "thumb_url";
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.libraryonclick);

    // getting intent data
    Intent in = getIntent();

    // Get XML values from previous intent
    String song = in.getStringExtra(KEY_SONG);
    String artist = in.getStringExtra(KEY_ARTIST);
    String thumb_url = in.getStringExtra(KEY_THUMB_URL);

    // Displaying all values on the screen
    TextView lblSong = (TextView) findViewById(R.id.textView1);
    TextView lblArtist = (TextView) findViewById(R.id.textView2);
    TextView lblThumb_Url = (TextView) findViewById(R.id.textView3);

    lblSong.setText(song);
    lblArtist.setText(artist);
    lblThumb_Url.setText(thumb_url);
}
}

here is the logcat

LOGCAT:

-21 17:16:30.812: D/AndroidRuntime(281): Shutting down VM
06-21 17:16:30.812: W/dalvikvm(281): threadid=1: thread exiting with uncaught exception       (group=0x4001d800)
06-21 17:16:30.862: E/AndroidRuntime(281): FATAL EXCEPTION: main
06-21 17:16:30.862: E/AndroidRuntime(281): android.content.ActivityNotFoundException:   Unable to find explicit activity class   {org.scouts.android/com.example.androidhive.SingleMenuItem}; have you declared this activity   in your AndroidManifest.xml?
06-21 17:16:30.862: E/AndroidRuntime(281):  at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1404)
06-21 17:16:30.862: E/AndroidRuntime(281):  at android.app.Instrumentation.execStartActivity(Instrumentation.java:1378)
06-21 17:16:30.862: E/AndroidRuntime(281):  at android.app.Activity.startActivityFromChild(Activity.java:3057)
06-21 17:16:30.862: E/AndroidRuntime(281):  at android.app.Activity.startActivityForResult(Activity.java:2837)
06-21 17:16:30.862: E/AndroidRuntime(281):  at android.app.Activity.startActivity(Activity.java:2923)
06-21 17:16:30.862: E/AndroidRuntime(281):  at com.example.androidhive.CustomizedListView$1.onItemClick(CustomizedListView.java:88)
06-21 17:16:30.862: E/AndroidRuntime(281):  at android.widget.AdapterView.performItemClick(AdapterView.java:284)
06-21 17:16:30.862: E/AndroidRuntime(281):  at android.widget.ListView.performItemClick(ListView.java:3382)
06-21 17:16:30.862: E/AndroidRuntime(281):  at android.widget.AbsListView$PerformClick.run(AbsListView.java:1696)
06-21 17:16:30.862: E/AndroidRuntime(281):  at android.os.Handler.handleCallback(Handler.java:587)
06-21 17:16:30.862: E/AndroidRuntime(281):  at android.os.Handler.dispatchMessage(Handler.java:92)
06-21 17:16:30.862: E/AndroidRuntime(281):  at  android.os.Looper.loop(Looper.java:123)
06-21 17:16:30.862: E/AndroidRuntime(281):  at android.app.ActivityThread.main(ActivityThread.java:4627)
06-21 17:16:30.862: E/AndroidRuntime(281):  at java.lang.reflect.Method.invokeNative(Native Method)
06-21 17:16:30.862: E/AndroidRuntime(281):  at java.lang.reflect.Method.invoke(Method.java:521)
06-21 17:16:30.862: E/AndroidRuntime(281):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
06-21 17:16:30.862: E/AndroidRuntime(281):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
06-21 17:16:30.862: E/AndroidRuntime(281):  at dalvik.system.NativeStart.main(Native Method)

thankyou for helping 🙂

  • 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-06T02:10:46+00:00Added an answer on June 6, 2026 at 2:10 am

    Force close happened because of the SingleMenuItem.java didn’t register yet in your AndroidManifest.xml file. Just register that like below of your <application> tag

        <application
            android:icon="@drawable/op"
            android:label="@string/app_name" >
            <activity
                android:name=".CustomizedListView"
                android:label="@string/app_name" >
                <intent-filter>
                    <action android:name="android.intent.action.MAIN" />
                    <category android:name="android.intent.category.LAUNCHER" />
                </intent-filter>
            </activity>
    
            <activity android:name=".SingleMenuItem" />
    </application>
    

    In your project having multiple activities means, You’ve to register that like above.

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

Sidebar

Related Questions

I have successfully parsed an XML file into a custom ListView , but how
I have a Custom Listview but i'm running into a weird issue when I
We have created custom listview by using the Base adapter. List view contains Text
HI Guyz i have created a sectioned custom listview using baseadapter its working fine
I have created custom listview in that have list of textview & list of
I have a custom listview and I am using a custom listadapter to display
i have custom listview with editText and edit the edittext data on tapping edittext
I have created a custom listview that is populated using a row.xml file. Each
I have a custom listview with three items. One of them is like Add
i have a custom expandable listview, and in the child of listview i have

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.