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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T11:04:57+00:00 2026-06-08T11:04:57+00:00

every thing seems right but cant find out the reason for error.. i followed

  • 0

every thing seems right but cant find out the reason for error..
i followed this blog.
define layout for the rows and use it in adapter

package com.joshclemm.android.tabs;

import android.app.ListActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;

public class ArchivedAudio_List extends ListActivity {
    static final String[] audiovalue = new String[] { "C by balguruswamy",
            "C++ by kanitkar", "java By Dr.kanitkar", ".net by Dr. joshi",
            "Sociology by Dr.Sarnaik", "Physoclgy by Dr.Batra" };

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        // TODO Auto-generated method stub
        super.onCreate(savedInstanceState);

        setListAdapter(new ArrayAdapter<String>(ArchivedAudio_List.this,
                R.layout.listview_with_img, R.id.label, audiovalue));
        ListView archiveaudio_listview = (ListView) findViewById(R.id.archiveaudio_list_listview);

        archiveaudio_listview.setOnItemClickListener(new OnItemClickListener() {

            @Override
            public void onItemClick(AdapterView<?> arg0, View arg1, int arg2,
                    long arg3) {
                // TODO Auto-generated method stub
                Toast.makeText(getApplicationContext(),
                        ((TextView) arg1).getText() + "clicked",
                        Toast.LENGTH_LONG).show();
                startActivity(new Intent(getApplicationContext(),
                        ArchiveAudio.class));

            }
        });

    }
}

listview_with_img.xml

<?xml version="1.0" encoding="utf-8"?>
<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/label"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@+id/label"
        android:textSize="20px" >
    </TextView>

   <ImageView
        android:id="@+id/icon"
        android:layout_width="22px"
        android:layout_height="22px"
        android:layout_marginLeft="4px"
        android:layout_marginRight="10px"
        android:layout_marginTop="4px"
        android:src="@drawable/play" >
    </ImageView>
</LinearLayout>

this is errorlogs

07-24 06:35:07.809: E/AndroidRuntime(564): FATAL EXCEPTION: main
07-24 06:35:07.809: E/AndroidRuntime(564): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.joshclemm.android.tabs/com.joshclemm.android.tabs.CustomTabActivity}: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.joshclemm.android.tabs/com.joshclemm.android.tabs.ArchivedAudio_List}: java.lang.NullPointerException
07-24 06:35:07.809: E/AndroidRuntime(564):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1955)
07-24 06:35:07.809: E/AndroidRuntime(564):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1980)
07-24 06:35:07.809: E/AndroidRuntime(564):  at android.app.ActivityThread.access$600(ActivityThread.java:122)
07-24 06:35:07.809: E/AndroidRuntime(564):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1146)
07-24 06:35:07.809: E/AndroidRuntime(564):  at android.os.Handler.dispatchMessage(Handler.java:99)
07-24 06:35:07.809: E/AndroidRuntime(564):  at android.os.Looper.loop(Looper.java:137)
07-24 06:35:07.809: E/AndroidRuntime(564):  at android.app.ActivityThread.main(ActivityThread.java:4340)
07-24 06:35:07.809: E/AndroidRuntime(564):  at java.lang.reflect.Method.invokeNative(Native Method)
07-24 06:35:07.809: E/AndroidRuntime(564):  at java.lang.reflect.Method.invoke(Method.java:511)
07-24 06:35:07.809: E/AndroidRuntime(564):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
07-24 06:35:07.809: E/AndroidRuntime(564):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
07-24 06:35:07.809: E/AndroidRuntime(564):  at dalvik.system.NativeStart.main(Native Method)
07-24 06:35:07.809: E/AndroidRuntime(564): Caused by: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.joshclemm.android.tabs/com.joshclemm.android.tabs.ArchivedAudio_List}: java.lang.NullPointerException
07-24 06:35:07.809: E/AndroidRuntime(564):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1955)
07-24 06:35:07.809: E/AndroidRuntime(564):  at android.app.ActivityThread.startActivityNow(ActivityThread.java:1796)
07-24 06:35:07.809: E/AndroidRuntime(564):  at android.app.LocalActivityManager.moveToState(LocalActivityManager.java:135)
07-24 06:35:07.809: E/AndroidRuntime(564):  at android.app.LocalActivityManager.startActivity(LocalActivityManager.java:347)
07-24 06:35:07.809: E/AndroidRuntime(564):  at android.widget.TabHost$IntentContentStrategy.getContentView(TabHost.java:682)
07-24 06:35:07.809: E/AndroidRuntime(564):  at android.widget.TabHost.setCurrentTab(TabHost.java:346)
07-24 06:35:07.809: E/AndroidRuntime(564):  at android.widget.TabHost.addTab(TabHost.java:236)
07-24 06:35:07.809: E/AndroidRuntime(564):  at com.joshclemm.android.tabs.CustomTabActivity.onCreate(CustomTabActivity.java:42)
07-24 06:35:07.809: E/AndroidRuntime(564):  at android.app.Activity.performCreate(Activity.java:4465)
07-24 06:35:07.809: E/AndroidRuntime(564):  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
07-24 06:35:07.809: E/AndroidRuntime(564):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1919)
07-24 06:35:07.809: E/AndroidRuntime(564):  ... 11 more
07-24 06:35:07.809: E/AndroidRuntime(564): Caused by: java.lang.NullPointerException
07-24 06:35:07.809: E/AndroidRuntime(564):  at com.joshclemm.android.tabs.ArchivedAudio_List.onCreate(ArchivedAudio_List.java:28)
07-24 06:35:07.809: E/AndroidRuntime(564):  at android.app.Activity.performCreate(Activity.java:4465)
07-24 06:35:07.809: E/AndroidRuntime(564):  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
07-24 06:35:07.809: E/AndroidRuntime(564):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1919)
07-24 06:35:07.809: E/AndroidRuntime(564):  ... 21 more
  • 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-08T11:04:59+00:00Added an answer on June 8, 2026 at 11:04 am

    You are using a ListActivity so dont use

    ListView archiveaudio_listview = (ListView) findViewById(R.id.archiveaudio_list_listview);
    

    Use it like this

    ListView archiveaudio_listview = getListView();
    

    Check this and this

    instead of onitemclick you can use this.

    @Override
    protected void onListItemClick(ListView l, View v, int position, long id) {
    
        //get selected items
        String selectedValue = (String) getListAdapter().getItem(position);
        Toast.makeText(this, selectedValue, Toast.LENGTH_SHORT).show();
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm having problems with Ruby scripts finding the right gems. It seems this is
I have been trying to work out the bug on this but can't seem
I've been searching all over StackOverflow but i couldn't find an answer for this.
I am new here. I've done some googling but cant seem to find the
edit: I figured it out. Well almost :) I fixed this issue, but I
Just installed EE everything seems clear however I can't seem to find a solution
I've been searching around for the answer and everything seems to lead that this
i feel my beard growing while trying to find out the Problem here. Basic
Ok guys, just a quick question hopefully someone can find my mistake quickly, but
I do not think this is a duplicate. I have done some reading but

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.