Reputation: 1231
It used to work, then I think it broke when I updated Eclipse to API 19. Now when I try to run my Maps Activity, I get the error: android.view.InflateException: Binary XML file line #15: Error inflating class fragment at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:587)
So I started over trying to recreate my Maps Activity using the tutorials found here. So now I'm back to just getting the map to display. Here's what I've got in the layout:
<fragment
android:id="@+id/map_wcbc_FRAG"
android:layout_width="match_parent"
android:layout_height="match_parent"
class="com.google.android.gms.maps.SupportMapFragment" />
and here's the Activity:
import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.GooglePlayServicesUtil;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.SupportMapFragment;
import android.app.AlertDialog;
import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.support.v4.app.FragmentManager;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
import android.widget.Toast;
public class WCBCMap extends FragmentActivity {
final int RQS_GooglePlayServices = 1;
private GoogleMap myMap;
Button back_BTN;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.wcbc_map);
back_BTN = (Button) findViewById(R.id.backMap_wcbc_btn);
FragmentManager myFragmentManager = getSupportFragmentManager();
SupportMapFragment mySupportMapFragment = (SupportMapFragment) myFragmentManager
.findFragmentById(R.id.map_wcbc_FRAG);
myMap = mySupportMapFragment.getMap();
// --- back button
back_BTN.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View arg0) {
Intent plI = new Intent(
"com....BUTTON_INTERFACE");
startActivity(plI);
finish();
}
});
// --- end back button
}// --- END onCreate
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.splash, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.menu_legalnotices:
String LicenseInfo = GooglePlayServicesUtil
.getOpenSourceSoftwareLicenseInfo(getApplicationContext ());
AlertDialog.Builder LicenseDialog = new AlertDialog.Builder(
WCBCMap.this);
LicenseDialog.setTitle("Legal Notices");
LicenseDialog.setMessage(LicenseInfo);
LicenseDialog.show();
return true;
}
return super.onOptionsItemSelected(item);
}
@Override
protected void onPause() {
super.onPause();
overridePendingTransition(R.anim.fadein, R.anim.fadeout);
}
@Override
protected void onResume() {
// TODO Auto-generated method stub
super.onResume();
int resultCode = GooglePlayServicesUtil
.isGooglePlayServicesAvailable(getApplicationContext());
if (resultCode == ConnectionResult.SUCCESS) {
Toast.makeText(getApplicationContext(),
"isGooglePlayServicesAvailable SUCCESS", Toast.LENGTH_LONG)
.show();
} else {
GooglePlayServicesUtil.getErrorDialog(resultCode, this,
RQS_GooglePlayServices);
}
}
}
and here's the Manifest relevant info:
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="18" />
<permission
android:name="com.myapp.wcbc.permission.MAPS_RECEIVE"
android:protectionLevel="signature" >
</permission>
<uses-permission android:name="com.myapp.wcbc.permission.MAPS_RECEIVE" />
<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" />
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-feature
android:glEsVersion="0x00020000"
android:required="true" />
.... <meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="my API Key is here" />
</application>
I'm targeting Android 4.22, I don't need to target Google APIs 4.22 do I? And I have the Google Play Services and Support v4 libraries in there. So can anyone see why the map won't inflate?
Upvotes: 0
Views: 615
Reputation: 3349
The new version of the Google Play Services library, including maps v2, drops support for API Level 8 (Froyo). It is now Gingerbread+.
You can either use an older version of the play services library, or drop support for Froyo in your own app.
http://android-developers.blogspot.com/2013/10/google-play-services-40.html
Upvotes: 1