Notice
Recent Posts
Recent Comments
Link
투케이2K
452. (android/java) [Fragment] 프레그먼트 기본 라이프 사이클 정의 클래스 (class) 본문
[개발 환경 설정]
개발 툴 : AndroidStudio
[소스 코드]
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.LinearLayout;
import com.common.S_Log;
public class Main_Frag extends Fragment {
/**
* // --------------------------------------------------------------------------------------
* TODO [클래스 설명]
* // --------------------------------------------------------------------------------------
* 1.
* // --------------------------------------------------------------------------------------
*/
/**
* // --------------------------------------------------------------------------------------
* TODO [빠른 로직 찾기 : 주석 로직 찾기]
* // --------------------------------------------------------------------------------------
* // [SEARCH FAST] : [] :
* // --------------------------------------------------------------------------------------
*/
// ------------------------------------------------------------------------------------------
// TODO [전역 변수 선언]
// ------------------------------------------------------------------------------------------
private String ACTIVITY_NAME = "Main_Frag";
// ------------------------------------------------------------------------------------------
// TODO [컴포넌트 선언]
// ------------------------------------------------------------------------------------------
// -----------------------------------------------------------------------------------------
// TODO [Main_Frag] : [클래스 생성자 초기화]
// -----------------------------------------------------------------------------------------
public Main_Frag() {
}
// -----------------------------------------------------------------------------------------
// TODO [프레그먼트 onCreate]
// -----------------------------------------------------------------------------------------
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
S_Log.i("---","---");
S_Log.d("//===========//","================================================");
S_Log.i("","\n"+"["+String.valueOf(ACTIVITY_NAME)+" >> onCreate() :: 프레그먼트 수행 실시]");
S_Log.i("","\n"+"-----------------------------------------");
S_Log.i("","\n"+"[설 명 :: [운영 설정] 화면 진입]");
S_Log.d("//===========//","================================================");
S_Log.i("---","---");
}
// -----------------------------------------------------------------------------------------
// TODO [onCreateView] : [프레그먼트 뷰 화면 초기화]
// -----------------------------------------------------------------------------------------
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
S_Log.i("---","---");
S_Log.d("//===========//","================================================");
S_Log.i("","\n"+"["+String.valueOf(ACTIVITY_NAME)+" >> onCreateView() :: 프레그먼트 뷰 화면 초기화]");
S_Log.d("//===========//","================================================");
S_Log.i("---","---");
LinearLayout layout = (LinearLayout)inflater.inflate(R.layout.fragment_layout, container, false);
try {
// -----------------------------------------
// [컴포넌트 매핑 실시]
// -----------------------------------------
}
catch (Exception e){
e.printStackTrace();
}
return layout;
}
// -----------------------------------------------------------------------------------------
// TODO [프레그먼트 onResume]
// -----------------------------------------------------------------------------------------
@Override
public void onResume(){
super.onResume();
S_Log.i("---","---");
S_Log.d("//===========//","================================================");
S_Log.i("","\n"+"["+String.valueOf(ACTIVITY_NAME)+" >> onResume() :: 프레그먼트 실행 준비]");
S_Log.d("//===========//","================================================");
S_Log.i("---","---");
}
// -----------------------------------------------------------------------------------------
// TODO [프레그먼트 onPause]
// -----------------------------------------------------------------------------------------
@Override
public void onPause(){
super.onPause();
S_Log.i("---","---");
S_Log.e("//===========//","================================================");
S_Log.i("","\n"+"["+String.valueOf(ACTIVITY_NAME)+" >> onPause() :: 프레그먼트 정지 상태]");
S_Log.e("//===========//","================================================");
S_Log.i("---","---");
}
// -----------------------------------------------------------------------------------------
// TODO [onDestroyView] : [프레그먼트 뷰 화면 종료]
// -----------------------------------------------------------------------------------------
@Override
public void onDestroyView() {
super.onDestroyView();
S_Log.i("---","---");
S_Log.d("//===========//","================================================");
S_Log.i("","\n"+"["+String.valueOf(ACTIVITY_NAME)+" >> onDestroyView() :: 프레그먼트 뷰 화면 종료]");
S_Log.d("//===========//","================================================");
S_Log.i("---","---");
}
// -----------------------------------------------------------------------------------------
// TODO [프레그먼트 onDestroy]
// -----------------------------------------------------------------------------------------
@Override
public void onDestroy(){
super.onDestroy();
S_Log.i("---","---");
S_Log.e("//===========//","================================================");
S_Log.i("","\n"+"["+String.valueOf(ACTIVITY_NAME)+" >> onDestroy() :: 프레그먼트 종료 상태]");
S_Log.e("//===========//","================================================");
S_Log.i("---","---");
}
} // TODO [클래스 종료]
반응형
'Android' 카테고리의 다른 글
Comments