Android Studio - 기본 프로젝트 형태 만들기

CODEDRAGON Development/Android

반응형

   

   

Android Studio >>>

app >>> java >>> com.tistory.codedragon.helloworldapp >>> MainActivity

   

   

기본 형태 만들기 단계

단계

설명

1

ActionBarActivity -> Activity로 수정

2

onCreate 밑에 있는 두개의 오버라이드 함수 삭제

   

package com.tistory.codedragon.helloworldapp;

import android.support.v7.app.ActionBarActivity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;

public class MainActivity extends ActionBarActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}

@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.menu_main, menu);
return true;
}

@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();

//noinspection SimplifiableIfStatement
if (id == R.id.action_settings) {
return true;
}

return super.onOptionsItemSelected(item);
}

}

   

   

기본형태 완료

   

package com.tistory.codedragon.helloworldapp;

import android.app.Activity;
import android.os.Bundle;

public class MainActivity extends Activity {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}

}

   

기본형태 완료 후 실행화면