2016-06-20 2 views
-1

here 안내에 따라 googleMaps를 내 MainActivity에 통합하려고하면 GpsLocation (링크 된 페이지의 주황색 상자 6)이라는 단어가 빨간색으로 변하고 -라고 표시됩니다.GpsLocation : 잘못된 메서드 선언입니다. 반환 유형 필요

나는 이것이 버튼이나 무언가 등의 내부에 있어야한다는 것을 안다.하지만 여기서 나는 아무런 생각이 없다. 무엇이이어야한다. 그러니 제 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(); 
    } 
} 

이 경우 GpsLocation 이름 당신에게하는 방법은 반환 형식을 가질 필요가

+1

당신이 점점 컴파일시 오류로 무엇을 이해하지 못했다? – Blackbelt

+0

나는 컴파일하지 않았다 .. 이것은 처음 손보기이다 (붉은 색이되고 경고를 준다) –

답변

1

감사합니다

여기 내 MainActivity입니다. 현재 반품 종류 만 있습니다.

public GpsLocation methodName (Context mContext, TextView gpsStatusTextView) { 

} 

하지

public GpsLocation (Context mContext, TextView gpsStatusTextView) { 

} 
+0

미안, 나는 당신을 얻지 못했다 –

+0

오하하우. 하하. 님이 댓글입니다! –

+0

더 혼란을 막기 위해 그것을 제거했습니다. –