ublic class MainActivity extends TabActivity {
TabHost host;
Button btn;
TextView txv;
EditText edt;
GoogleMap mGoogleMap;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
host = getTabHost();
TabHost.TabSpec spec;
spec = host.newTabSpec("1st").setContent(R.id.tab1).setIndicator("MAP");
host.addTab(spec);
init();
spec = host.newTabSpec("2st").setContent(R.id.tab2).setIndicator("등록");
host.addTab(spec);
host.setCurrentTab(0);
btn = (Button) findViewById(R.id.button1);
btn.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
edt = (EditText) findViewById(R.id.editText1);
String User = edt.getText().toString();
edt.setText("Hello!!" + User);
}
});
}
private void init() {
Intent getI = getIntent();
String title = getI.getStringExtra("title");
String coordinates[] = { "37.532163", "126.846487" };
double lat = Double.parseDouble(coordinates[0]);
double lng = Double.parseDouble(coordinates[1]);
LatLng position = new LatLng(lat, lng);
GooglePlayServicesUtil.isGooglePlayServicesAvailable(MainActivity.this);
SupportMapFragment fragment;
fragment = (SupportMapFragment) getMapFragmentManager()
.findFragmentById(R.id.map);
형광펜 쳐진곳이 지금 오류입니다 ㅠㅠ
tabactivity 로 진행중이라.. fragmentactivity를 불가피하게 못 쓰는 상황이라..
구글맵을 불러오려는데 역시나 fragmentactivity 일때만 가능하더라구요ㅜㅜ
Tabactivity 일때도 구글맵을 쓰고싶은데 어떻게 해야하나용 ?ㅠㅠㅜ
mGoogleMap = fragment.getMap();
mGoogleMap.moveCamera(CameraUpdateFactory.newLatLngZoom(position, 15));