Wenn Sie versuchen, googleMaps in meine MainActivity zu integrieren, folgen Sie den Anweisungen here, das Wort (orange Box 6 auf der verknüpften Seite) wird rot und sagt: Invalid method declaration; return type required
.GpsLocation: Ungültige Methodendeklaration; Rückgabetyp erforderlich
Ich weiß, das bedeutet, dass es innerhalb eines Knopfes sein muss oder eine Leere oder so etwas, aber hier habe ich keine Ahnung was es in sein muss. Also bitte einen Blick auf meine MainActivity nehmen, und sagen Sie mir, wo ich falsch liege.
Hier ist meine MainActivity:
package com.lalalaala.mapstest;
import android.content.Context;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.widget.TextView;
import android.widget.Toast;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.MapFragment;
public class MainActivity extends AppCompatActivity {
private GoogleMap googleMap; // Might be null if Google Play services APK is not available.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
if (googleMap == null) {
googleMap = ((MapFragment) getFragmentManager().findFragmentById(R.id.map)).getMap();
// check if map is created successfully or not
if (googleMap == null) {
Toast.makeText(getApplicationContext(),
"Sorry! unable to create maps", Toast.LENGTH_SHORT).show();
}
else {
// Changing map type
//TODO
}
}
}
public GpsLocation (Context mContext, TextView gpsStatusTextView) {
this.mContext = mContext;
this.gpsStatusTextView = gpsStatusTextView;
getLocation();
}
}
Danke
was hast du nicht der Fehler bei der Kompilierung verstehen Sie bekommen? – Blackbelt
Ich habe nicht kompiliert .. das ist die erste Hand-Ansicht (es wird rot und gibt Warnungen) –