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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T19:43:29+00:00 2026-05-20T19:43:29+00:00

I have to call mapactivity from list activity.whenever user click on item on listview,

  • 0

I have to call mapactivity from list activity.whenever user click on item on listview, map activity should get fire.But when item is clickd i m getting exception that your map activity class not found.

if i place simple acitivity insted of map activity..my code worked well..i dont know why the exception is raised

here is my code.

XML FIle

<?xml version="1.0" encoding="utf-8"?>

            <!--Header -->
<LinearLayout android:id="@+id/Header" 
            android:background="#EE7621" 
            android:layout_width="fill_parent"
             android:layout_height="35dip" android:orientation="horizontal">

    <Button android:id="@+id/backPantries" 
            android:background="@drawable/pantryback"
            android:layout_marginTop="2dip" 
            android:layout_width="wrap_content" 
            android:layout_height="wrap_content">
    </Button>


</LinearLayout>

 <TextView android:textColor="#00AF33" android:background="#FFFFFF" android:text="pantryNameOnMap" android:id="@+id/pantryNameOnMap" android:layout_width="fill_parent" android:layout_height="wrap_content" android:textSize="15dip"></TextView>

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

  <com.google.android.maps.MapView
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/singlePantry"
         android:layout_width="fill_parent"
        android:layout_height="390dip"
         android:gravity="center" 
        android:clickable="true"
        android:apiKey="016JeH4RyEu_PJVdseJdN45AnkUvFrjE6gwLh9w"/>



</LinearLayout>

<TextView android:textColor="#00AF33" android:background="#FFFFFF" android:text="pantryPhNoOnMap" android:id="@+id/pantryPhNoOnMap" android:layout_width="fill_parent" android:layout_height="wrap_content" android:gravity="center" android:textSize="15dip"></TextView>


<LinearLayout android:id="@+id/linearLayout1" 
            android:background="@drawable/footer"
             android:gravity="bottom" 
             android:orientation="vertical"
              android:layout_width="wrap_content"
               android:layout_height="wrap_content">
</LinearLayout>

HERE IS MY JAVA FILE

 package com.example;

import java.net.URL;
import java.util.ArrayList;

import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;

import org.xml.sax.InputSource;
import org.xml.sax.XMLReader;



import android.app.ListActivity;
import android.app.ProgressDialog;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;
import android.widget.AdapterView.OnItemClickListener;

public class OnlineUsersList extends ListActivity
{
    public static ArrayList<UserInfo> m_user=new ArrayList<UserInfo>();
    OnlineUserInfo parsedOnlineUserInfo;
    ImageAdapter m_adapter;
    private Runnable viewOrders;
    ProgressDialog m_ProgressDialog=null;
    Intent myIntent;
    @Override
    public void onCreate(Bundle savedInstanceState) 
    {
        super.onCreate(savedInstanceState);
        TextView tv=new TextView(this);
        Bundle bundle=new Bundle();
        bundle=this.getIntent().getExtras();
        String username=bundle.getString("username");
        String password=bundle.getString("password");
        tv.setText(username + " "+ password);
        setContentView(R.layout.onlineuserlist);
        this.m_adapter=new ImageAdapter(this, R.layout.onlineuserlistrow,m_user);
        setListAdapter(this.m_adapter);
        m_adapter.clear();
        ListView lv = getListView();
        lv.setTextFilterEnabled(true);

        lv.setOnItemClickListener(new OnItemClickListener()
        {


            public void onItemClick(AdapterView<?> parent, View view,int Position,long id)
            {
                Toast.makeText(OnlineUsersList.this,"hi",Toast.LENGTH_LONG).show();
                myIntent=new Intent(OnlineUsersList.this,SinglePantriesOnMap.class);
                startActivityForResult(myIntent, 0);
            }
        });
        viewOrders = new Runnable()
        {
            @Override
            public void run() 
            {
                try
                {
                    String url="http://www.lafoodbank.org/iphone/general-xml.aspx?mode=volunteer";
                    SAXParserFactory spf=SAXParserFactory.newInstance();
                    SAXParser sp=spf.newSAXParser();
                    XMLReader xr=sp.getXMLReader();
                    URL sourceURL= new URL(url);
                    OnlineUserXMLHandler onlineUserXmlHandler=new OnlineUserXMLHandler();
                    xr.setContentHandler(onlineUserXmlHandler);
                    xr.parse(new InputSource(sourceURL.openStream()));

                    parsedOnlineUserInfo=OnlineUserXMLHandler.getOnlineUserInfo();

                      getOnlineUsers();
                      try
                      {
                        Thread.sleep(1000);
                      }
                     catch (InterruptedException e)
                     {
                        e.printStackTrace();
                     }
                      runOnUiThread(returnRes);

                }
                catch(Exception e)
                {
                    System.out.println("====>Exception Raised in Parsing:"+ e);
                }

                 System.out.println("=============================================>>Total volunteers:"+parsedOnlineUserInfo.getName().size());
                runOnUiThread(returnRes);
            }

        };

        Thread thread =  new Thread(null, viewOrders, "MagentoBackground");
        thread.start();

          m_ProgressDialog = ProgressDialog.show(OnlineUsersList.this,    
             "Please Wait...!", "Retriving Volunteers...", true);





    }///on creat over
     private Runnable returnRes = new Runnable() 
     {

            @Override
            public void run()
            {
                if(m_user != null && m_user.size() > 0){
                    m_adapter.notifyDataSetChanged();

                    for(int i=0;i<m_user.size();i++)
                        m_adapter.add(m_user.get(i));
                }
                TextView total=(TextView)findViewById(R.id.totalVolunteers);
                total.setText("Total "+parsedOnlineUserInfo.getVId().size()+"Volunteers");       

                m_ProgressDialog.dismiss();
                m_adapter.notifyDataSetChanged();
            }
     };

    public void getOnlineUsers()
    {
        m_user=new ArrayList<UserInfo>();
        UserInfo user[]=null;
        user=new UserInfo[parsedOnlineUserInfo.getVId().size()];

        for(int i=0;i<parsedOnlineUserInfo.getVId().size();i++)
        {
            user[i]=new UserInfo();


            String vid=parsedOnlineUserInfo.getVId().get(i);
            String name=parsedOnlineUserInfo.getName().get(i);
            String organization=parsedOnlineUserInfo.getOrganization().get(i);
            String email=parsedOnlineUserInfo.getEmail().get(i);
            String longitude=parsedOnlineUserInfo.getLongitude().get(i);
            String latitude=parsedOnlineUserInfo.getLatitude().get(i);
            String address=parsedOnlineUserInfo.getAddress().get(i);
            String city=parsedOnlineUserInfo.getCity().get(i);
            String state=parsedOnlineUserInfo.getState().get(i);
            String otherState=parsedOnlineUserInfo.getOtherState().get(i);
            String zipCode=parsedOnlineUserInfo.getZipCode().get(i);
            String loginStatus=parsedOnlineUserInfo.getLoginStatus().get(i);
            String phone=parsedOnlineUserInfo.getPhone().get(i);
            String mobId=parsedOnlineUserInfo.getMobId().get(i);

            user[i].setVId(vid);
            user[i].setName(name);
            user[i].setOrganization(organization);
            user[i].setEmail(email);
            user[i].setLongitude(longitude);
            user[i].setLatitude(latitude);
            user[i].setAddress(address);
            user[i].setCity(city);
            user[i].setState(state);
            user[i].setOtherState(otherState);
            user[i].setZipCode(zipCode);
            user[i].setLoginStatus(loginStatus);
            user[i].setPhone(phone);
            user[i].setMobId(mobId);

            System.out.println("\n\n"+(i+1)+ " Volunteer");
            System.out.println("======================>USER INFO:ID"+user[i].getVId());
            System.out.println("======================>USER INFO:name"+user[i].getName());
            System.out.println("======================>USER INFO:organization"+user[i].getOrganization());
            System.out.println("======================>USER INFO:Email"+user[i].getEmail());
            System.out.println("======================>USER INFO:Longitude"+user[i].getLongitude());
            System.out.println("======================>USER INFO:Latitude"+user[i].getLatitude());
            System.out.println("======================>USER INFO:Addreess"+user[i].getAddress());
            System.out.println("======================>USER INFO:City"+user[i].getCity());
            System.out.println("======================>USER INFO:State"+user[i].getState());
            System.out.println("======================>USER INFO:OtherState"+user[i].getOtherState());
            System.out.println("======================>USER INFO:ZipCode"+user[i].getZipCode());
            System.out.println("======================>USER INFO:LOGIN STATUS"+user[i].getLoginStatus());
            System.out.println("======================>USER INFO:Phone"+user[i].getPhone());
            System.out.println("======================>USER INFO:MobileID"+user[i].getMobId());

            m_user.add(user[i]);
            //m_adapter.add(m_user.get(i));

        }

    }

    class ImageAdapter extends ArrayAdapter<UserInfo> 
    {
        private ArrayList<UserInfo> items;

        public ImageAdapter(Context context, int textViewResourceId,ArrayList<UserInfo> items) 
        {
            super(context, textViewResourceId, items);
            this.items = items;

        }

        public View getView(final int position, View convertView, ViewGroup parent) 
        {

            View v = convertView;
            if (v == null) 
            {
                try
                {
                LayoutInflater vi = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
                v = vi.inflate(R.layout.onlineuserlistrow, null);



                    }
                catch(Exception e)
                {
                    System.out.println("Excption Caught"+e);
                }
            }
            UserInfo user = items.get(position);


            if (user != null) 
            {
                TextView volunteerName = (TextView) v.findViewById(R.id.volunteerName);
                ImageView statusImg=(ImageView)v.findViewById(R.id.statusImg);

                if (volunteerName != null)
                {
                    volunteerName.setText(user.getName());
                }
                if(statusImg != null)
                {
                    int loginStatus=Integer.parseInt(user.getLoginStatus());
                    if(loginStatus==1)
                    {
                        statusImg.setImageResource(R.drawable.online);
                    }
                    else
                    {
                        statusImg.setImageResource(R.drawable.offline);
                    }
                }

            }


                return v;
        }

    }

}

If I PLACE SIMPLE ACTIVITY and remove MAPVIEW FROM XML FILE THEN MY CODE WORKS WELL…BUT WHEN I DECLARE ACTIVITY AS MAPACTIVITY and Place Mapview in XML File then EXCEPTION IS RAISED WHICH SAYS THAT COULD NOT FIND CLASS OF MAP ACTIVITY WHICH IS REFRENCED FROM onListItemClickListener()

  • 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-20T19:43:30+00:00Added an answer on May 20, 2026 at 7:43 pm

    I don’t see it here, but you need a line like this in your android manifest file. It needs to be outside the activity tag and within the application tag.

    <uses-library android:name="com.google.android.maps"/>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've written an application that creates a map activity. From there the user can
I have an onClickListener that should call a class that shows and image from
I have an activity, I'll call it mainactivity for now. And I want to
I have a call to powershell.exe that looks like this, and which works from
I have to call a stored procedure and get the results. I know there
I have a public class FriendMaps extends MapActivity that gets called from a menu
I have a ListView with ViewSwitcher items. The goal is to tap a list
I have one application. I need to display a map view when we click
I have an AsyncTask, that fills a custom List with parsed data from Internet.
I have a method call isNetworkAvailable() to check if the user have enable wap/wifi/wimax

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.