- Joined
- Mar 21, 2009
- Messages
- 6,614 (1.11/day)
- Location
- Midlands,UK
System Name | His|Her |
---|---|
Processor | AMD Ryzen 5 9600x|AMD Ryzen 7 5700x |
Motherboard | Asrock B650m Pro-RS|Asus B550m Prime Wifi |
Cooling | Arctic cooling freezer 34 white + Montech 120mm | Thermalright Silversoul 135 + Corsair 140mm white |
Memory | Corsair Vengeance DDR5 32GB 6000mhz|Corsair Vengeance DDR4 16GB 3200mhz |
Video Card(s) | XFX AMD RX 9070XT Swift Black 16GB| Zotac Nvidia RTX 4080 Super Trinity black edition 16GB |
Storage | 2x2TB WD Black SN1700|WD Blue 500GB NVME,Kingston 240GB SSD,2TB Corsair NVME |
Display(s) | AOC Agon pro AG326UD | Iiyama XUB2792QSU gen 2 + Iiyama XUB2792QSU gen 1 |
Case | Montech Air 100 White| Corsair Carbide Air 240 White |
Audio Device(s) | onboard/Speakers: Logitech G560 | onboard/Speakers: Sanyun SW208 white 2.0 |
Power Supply | Seasonic Focus GX 850w Gold Modular | Corsair RMx White 750w Gold Modular |
Mouse | Microsoft Pro Intellimouse shadow | Razer Deathadder Essential white |
Keyboard | Epomaker mechanical keyboard| Razer huntsman v2 |
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();
}