私はAndroidが初めてで、GEoFencingクラスのgooglemapで2日間のエラーが発生しました。親切により良い解決策を提供してください
public class GeoFencingeg extends Activity implements ConnectionCallbacks,OnConnectionFailedListener,LocationListener{
LocationRequest lr;
GoogleApiClient mclient;
TextView txt;
Location mLastLocation;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_geo_fencingeg);
txt=(TextView)findViewById(R.id.tv);
lr=LocationRequest.create();
mLastLocation=new Location("");
Toast.makeText(getApplicationContext(), "Google API"+GooglePlayServicesUtil.isGooglePlayServicesAvailable(getApplicationContext()), Toast.LENGTH_LONG).show();
try{
mclient=new GoogleApiClient.Builder(this).addConnectionCallbacks(this)
.addOnConnectionFailedListener(this)
.addApi(Plus.API,new Plus.PlusOptions.Builder().build())
.addScope(Plus.SCOPE_PLUS_LOGIN).build();
mclient.connect();
}
catch(Exception e){
Log.i("Exception", e.getMessage());
}
}
@Override
protected void onStart() {
// TODO Auto-generated method stub
super.onStart();
}
@Override
protected void onDestroy() {
// TODO Auto-generated method stub
super.onDestroy();
if(mclient.isConnected())
mclient.disconnect();
}
@Override
public void onLocationChanged(Location location) {
// TODO Auto-generated method stub
txt.setText("Current Location"+location.toString());
}
@Override
public void onConnectionFailed(ConnectionResult arg0) {
// TODO Auto-generated method stub
}
@Override
public void onConnected(Bundle arg0) {
// TODO Auto-generated method stub
lr.setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY);
lr.setInterval(1000);
LocationServices.FusedLocationApi.requestLocationUpdates(mclient, lr, this);
}
@Override
public void onConnectionSuspended(int arg0) {
// TODO Auto-generated method stu
}
}
コンパイル中に不明なソースが GoogleApiClient.Builder().Build() に見つかりました。
最善の解決策