# Android - Google API and fragments



## kurosagi01 (Apr 24, 2015)

Hello all,need some help with my program. So i was following this tutorial: http://www.androidhive.info/2015/02/android-location-api-using-google-play-services/
and i have 2 major error in my code which i can't seem to fix apart from changing the Fragment class to Fragment Activity,but when i do i get problems with the Navigation drawer which tells me i need change it which i understand how but i also get problem with that. 
But i want first see if i can fix the code without changing the Fragment class,the 2 errors i get are:
1st says GooglePlayServicesAvailable(android.context.Context)  in GooglePlayService.Util cannot be applied and GeterrorDialog() in GooglePlayService.Util cannot be applied to because its not an Activity class which i have established.


> private boolean checkPlayServices() {
> int resultCode = GooglePlayServicesUtil
> .isGooglePlayServicesAvailable(this);
> if (resultCode != ConnectionResult.SUCCESS) {
> ...


2nd error Builder(android.context.Context) cannot be applied:


> protected synchronized void buildGoogleApiClient() {
> GoogleAPI = new GoogleApiClient.Builder(this)
> .addConnectionCallbacks(this)
> .addOnConnectionFailedListener(this)
> ...



Is there any way to work around this without changing the Fragment to a FragmentActivity class?
If i have to change to FragmentActivity how would i work about fixing this part:
I have highlighted the main problem and i understand i need use getSupportFragmentManager but when i do change it and import correctly i get the same problem still.


> Fragment fragments = null;
> 
> switch (position) {
> case 0:
> ...


----------



## Batou1986 (Apr 24, 2015)

Not to sound like a dick but XDA developers would be a much better place for this, not many android people here.

Try the general section http://forum.xda-developers.com/android some one there can definately help you.


----------



## kurosagi01 (Apr 24, 2015)

Batou1986 said:


> Not to sound like a dick but XDA developers would be a much better place for this, not many android people here.
> 
> Try the general section http://forum.xda-developers.com/android some one there can definately help you.



Thats cool Batou was hoping to see if anyone know on this forum.


----------

