- Joined
- Mar 21, 2009
- Messages
- 6,190 (1.12/day)
- Location
- Midlands,UK
System Name | Ultraman |
---|---|
Processor | Intel core i9 13900HK |
Motherboard | Alienware/Dell inverted motherboard |
Cooling | Alienware/Dell cooling solution + IETS GT500 cooling pad |
Memory | Alienware/Dell 32GB 6000mhz DDR5 |
Video Card(s) | Nvidia RTX4080 12GB |
Storage | 1TB Dell supplied NVME + Samsung Evo 1TB NVME |
Display(s) | AOC Gaming CU34G3S/BK |
Case | Alienware X16 |
Audio Device(s) | onboard/Speakers: Logitech G560 |
Power Supply | Alienware/Dell battery + 330W charger |
Mouse | Microsoft Pro Intellimouse - White |
Keyboard | Ducky One2 SF White MX cherry Red |
Software | Windows 11 |
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.
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.
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.
2nd error Builder(android.context.Context) cannot be applied:private boolean checkPlayServices() {
int resultCode = GooglePlayServicesUtil
.isGooglePlayServicesAvailable(this);
if (resultCode != ConnectionResult.SUCCESS) {
if (GooglePlayServicesUtil.isUserRecoverableError(resultCode)) {
GooglePlayServicesUtil.getErrorDialog(resultCode, this,
Play_Service).show();
}
}
return false;
}
protected synchronized void buildGoogleApiClient() {
GoogleAPI = new GoogleApiClient.Builder(this)
.addConnectionCallbacks(this)
.addOnConnectionFailedListener(this)
.addApi(LocationServices.API).build();
}
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:
fragments = new pedometer();
break;
case 1:
fragments = new map();
break;
case 2:
fragments = new statspage();
}
FragmentManager fragmentManager = getFragmentManager();
fragmentManager.beginTransaction()
.replace(R.id.container, fragments)
.commit();
}