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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T01:09:07+00:00 2026-06-10T01:09:07+00:00

When I use this XML file. My Below Java Code works fine. <?xml version=1.0

  • 0

When I use this XML file. My Below Java Code works fine.

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical" 
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:background="#FFFFFF"> 

     <ListView
        android:id="@+id/listView1"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent" />

</LinearLayout>

And when I start using this XML file,

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical" >

    <com.google.android.maps.MapView
        android:id="@+id/mapView"
        android:layout_width="fill_parent"
        android:layout_height="0dp"
        android:layout_weight="1"
        android:apiKey="0s_fADEBtq0-j_teQ1j-yaoDAivoHHtwN81rJ-g"
        android:clickable="true"
        android:state_enabled="true" />

    <LinearLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="fill_parent"
        android:layout_height="0dp"
        android:layout_weight="1"
        android:orientation="horizontal" >

        <ListView
            android:id="@+id/listView1"
            android:layout_width="164dp"
            android:layout_height="142dp"
            android:layout_weight="0.33" >
        </ListView>
    </LinearLayout>

</LinearLayout>

so that at the top half of the Android screen, I can show Google Map and in the bottom half, I can show ListView with images. But whenever I use this XML file, it start giving me an exception like-

java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.example.weatheractivity/com.example.weatheractivity.MainActivity}: java.lang.ClassNotFoundException: com.example.weatheractivity.MainActivity

Below is the Java Code:-

public class MainActivity extends MapActivity {

    private ListView listView1;
    private MapView mapView;
    private MapController mapController;

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

        Weather weather_data[] = new Weather[]
                                             {
                new Weather(R.drawable.ic_launcher, "Cloudy"),
                new Weather(R.drawable.ic_launcher, "Showers"),
                new Weather(R.drawable.ic_launcher, "Snow"),
                new Weather(R.drawable.ic_launcher, "Storm"),
                new Weather(R.drawable.ic_launcher, "Sunny")
                                             };

        WeatherAdapter adapter = new WeatherAdapter(this, 
                R.layout.listview_item_row, weather_data);


        mapView = (MapView) findViewById(R.id.mapView);
        // enable Street view by default
        mapView.setStreetView(true);

        mapView.setBuiltInZoomControls(true);

        mapController = mapView.getController();
        mapController.setZoom(15);


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

        View header = (View)getLayoutInflater().inflate(R.layout.listview_header_row, null);
        listView1.addHeaderView(header);

        listView1.setAdapter(adapter);
    }

    @Override
    protected boolean isRouteDisplayed() {
        // TODO Auto-generated method stub
        return false;
    }
    }
  • 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-10T01:09:09+00:00Added an answer on June 10, 2026 at 1:09 am

    Because the Maps library is not a part of the standard Android library, you must declare it in the Android Manifest. Open the AndroidManifest.xml file and add the following as a child of the element:

    <uses-library android:name="com.google.android.maps"/>
    

    https://developers.google.com/maps/documentation/android/hello-mapview

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

Sidebar

Related Questions

I have an XML document that looks like this: <?xml version=1.0 encoding=UTF-8?> <xs:msgdata xmlns:xs=http://www.myCompany.com
Hi I use this code to save an xml file using (IsolatedStorageFile myIsolatedStorage =
I wanna use custom font file. For that below is my code XML file:
I have this use case of an xml file with input like Input: <abc
Possible Duplicate: Enforcing spaces in string resources This is the strings.xml file I use
When using XML serialization in C#, I use code like this: public MyObject LoadData()
I use C# code more-or-less like this to serialize an object to XML: XmlSerializer
Below is my XML File - <CVs> <CV> <Name>ABC</Name> <Address></Address> <Introduction></Introduction> <CompSkills>Java, XSLT, XPATH,
When i use class-path attribute in spring XML file as below, <bean class=com.fritolay.suppliernet.common.lastresorthandler.impl.SingletonPropertiesRepository> <property
I have used this Java NIO to download a xml file from Google Direction.

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.