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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T14:36:25+00:00 2026-06-16T14:36:25+00:00

Happy New Year All, New with implementing Fragments in Android (and I have seen

  • 0

Happy New Year All,

New with implementing Fragments in Android (and I have seen similar posts but I have not been able to get an answer for my problem), so here goes:

I wish to use SupportMapFragment (referenced from the support library v4) and I have created a class that extends FragmentActivity, called TripSummary.java:

package com.project.locationapp;

import com.google.android.gms.common.GooglePlayServicesUtil;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.SupportMapFragment;
import android.os.Bundle;
import android.content.Intent;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.Toast;

public class TripSummary extends android.support.v4.app.FragmentActivity {

private GoogleMap mMap;

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    Intent intent = new Intent(this, LocationService.class);
    stopService(intent);
    setContentView(R.layout.activity_trip_summary);

    createMap();
}

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    getMenuInflater().inflate(R.menu.activity_trip_summary, menu);
    return true;
}


@Override
public boolean onOptionsItemSelected(MenuItem item) {
    //Content?
    return super.onOptionsItemSelected(item);
}

private void createMap(){
    //if a map has not already been instantiated it'll return null
    if(mMap == null){
        //instantiate map
        mMap = ((SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map)).getMap();
        //check it has been instantiated
        if(mMap != null){
            Toast.makeText(this, "map done", Toast.LENGTH_SHORT)
            .show();
            //Manipulate map here (add coordinates/polylines from trip etc etc.)
        }
    }
}

}

Which gets a layout from activity_trip_summary.xml

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent" >

<TextView
    android:id="@+id/tripSummary"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_centerHorizontal="true"
    android:text="@string/trip_summary"
    tools:context=".Start" />

<TextView
    android:id="@+id/tripDetails"
    android:layout_below="@id/tripSummary"
    android:layout_alignParentLeft="true"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_centerHorizontal="true"
    android:text="@string/awaiting_location"
    tools:context=".Start" />

<Fragment
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:map="http://schemas.android.com/apk/res-auto"
    android:id="@+id/map"
    android:layout_below="@id/tripDetails"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:name="com.google.android.gms.maps.SupportMapFragment" />

</RelativeLayout>

AndroidManifest.xml is as follows:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
   package="com.project.locationapp"
   android:versionCode="1"
   android:versionName="1.0" >

<uses-sdk
    android:minSdkVersion="8"
    android:targetSdkVersion="15" />
<permission
      android:name="com.project.locationapp.permission.MAPS_RECEIVE"
      android:protectionLevel="signature"/>
<uses-permission android:name="com.project.locationapp..permission.MAPS_RECEIVE"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-feature
    android:glEsVersion="0x00020000"
    android:required="true"/>


<application
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme" >

    <activity
        android:name="com.project.locationapp.Start"
        android:label="@string/title_activity_start" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>

    <service android:name="com.project.locationapp.LocationService" />

    <activity
        android:name="com.project.locationapp.TripSummary"
        android:label="@string/title_activity_trip_summary" >
        <meta-data
            android:name="android.support.PARENT_ACTIVITY"
            android:value="com.project.locationapp.Start" />
    </activity>
    <activity
        android:name="com.project.locationapp.ViewTrips"
        android:label="@string/title_activity_view_trips" >
    </activity>
    <activity
        android:name="com.project.locationapp.TripDetail"
        android:label="@string/title_activity_trip_detail" >
    </activity>
    <meta-data
        android:name="com.google.android.maps.v2.API_KEY"
        android:value="<-- My Key -->"/>
</application>

</manifest>

The problem I am having in that each time I try to load the activity TripSummary, I get a ‘Sorry! stopped unexpectedly’ dialog and the app crashes.

LogCat:

java.lang.RuntimeException: Unable to start activity                   ComponentInfo{com.project.locationapp/com.project.locationapp.TripSummary}:     android.view.InflateException: Binary XML file line #24: Error inflating class Fragment

I am referencing the google-play-services_lib library (which is also in my workspace) and I also have a copy of android-support-v4.jar in /libs directory within my project.

If you know an answer to my problem, please share!

Thanks in advance.

  • 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-16T14:36:26+00:00Added an answer on June 16, 2026 at 2:36 pm

    Please replace:

    <Fragment
    

    with:

    <fragment
    

    Also, you can get rid of the redundant/incorrect namespace declarations in that element.

    Also also, in the future, post the complete stack trace, not just part of one line, to make it easier for people to help you.

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

Sidebar

Related Questions

first of all an Happy New Year to all :) I have found that
First of all-many season-greetings and a happy new year to all of you! Have
First of all, Happy New Year to anybody out there reading this! I have
Happy New Year. I have a bunch of SOAP Web Services. They all have
Hello all and a Happy New Year SITUATION: I have some tables in MySQL
A VERY HAPPY AND PROSPEROUS NEW YEAR TO ALL. I have started learning ROR
Happy New Year SO users! I have an issue that I hope someone can
Hello and Happy New Year all! While thinking about new project I decided to
Happy New Year Everyone! I have this existing php code I did when I
hope you all had a happy new year. So, my question is, what's the

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.