Vote count:
0
I am having a lot of trouble finding any answers to this problem! Earlier this week when I would load this application up without an issue, but when I hit the Maps tab the application crashes. now it won't even run and am going crazy! I've been working on this for a week and many hours. I really need help, there's something going on between the mapfragment.java and the fragment_map I ASSUME. I am brand new to coding and maybe I have no idea, but here it is... my MapFragment.java:
import android.app.Activity;
import android.os.Bundle;
import com.google.android.gms.maps.SupportMapFragment;
public class MapFragment extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.fragment_map);
}
@Override
public void onDestroyView() {
MapFragment f = (MapFragment) getFragmentManager()
.findFragmentById(R.id.map);
if (f != null) {
try {
getFragmentManager().beginTransaction().remove(f).commit();
} catch (Exception e) {
e.printStackTrace();
}
}
super.onDestroyView();
}
this is my fragment_map.xml:
<RelativeLayout xmlns:android="http://ift.tt/nIICcg"
xmlns:tools="http://ift.tt/LrGmb4"
android:layout_width="match_parent"
android:layout_height="match_parent">
<fragment
android:id="@+id/ContactMapView"
android:name="com.google.android.gms.maps.MapFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
/>
and my androidmanifest.xml:
<?xml version="1.0" encoding="utf-8"?>
<permission android:name="info.teammumu.cougarcardapp.permission.MAPS_RECEIVE" android:protectionLevel="signature"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<!-- The following two permissions are not required to use
Google Maps Android API v2, but are recommended. -->
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<!-- Permission to receive Google Maps -->
<uses-permission android:name="info.teammumu.cougarcardapp.MAPS_RECEIVE" />
<uses-feature
android:glEsVersion="0x00020000"
android:required="true"/>
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name=".MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="my api key"/>
</application>
Am I missing an extra file or what should I do?
Thank you to whomever answers!
asked 21 secs ago
Google Maps API inside Navigation Drawer Crashes
Aucun commentaire:
Enregistrer un commentaire