로딩화면이 처음에 시작해서 프로그래스 바가 꽉차고 메인 액티비티가 실행이되요 근데 되자마자 바로 또 로딩 화면이 재시작합니다 ㅠ 그렇게 계속 반복되요 ㅠㅠ 해결방법좀 알려주십사 올려봅니다 ㅠ 지금 3시간동안 고민하고있는데 안되네요 ㅠ 아 그리고 앱 킨상태에서 로딩화면 끝나고 메인떳을때 그상태에서 앱을 끄고나서 다시켰을떄 로딩화면부터 처음부터 다시시작하는법도 알고싶습니다~
Loding.java
=======================================
package js.schoolapp;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.widget.ProgressBar;
public class Loding extends Activity{
ProgressBar m_PrograssReceive;
private int tempCount = 0;
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.lodingg);
m_PrograssReceive = (ProgressBar)findViewById(R.id.ID_PGB_RCVPER);
}
Handler Activityhdlr = new Handler(){
@Override
public void handleMessage(Message msg) {
super.handleMessage(msg);
if(tempCount >= 150){
Intent intent = new Intent(Loding.this,SchoolAppActivity.class);
startActivityForResult(intent,3);
finish();
}
else
{
tempCount++;
m_PrograssReceive.incrementProgressBy(1);
setProgress(m_PrograssReceive.getProgress()*150);
StartThread();//Activityhdlr.sendEmptyMessageDelayed(0, 20);
}
}
};
private void StartThread()
{
Activityhdlr.sendEmptyMessage(1000);
}
@Override
protected void onDestroy() {
super.onDestroy();
}
@Override
protected void onPause() {
// TODO Auto-generated method stub
super.onPause();
}
@Override
protected void onResume() {
// TODO Auto-generated method stub
super.onResume();
StartThread();
//timer 실행 예제
}
@Override
protected void onStart() {
super.onStart();
StartThread();
}
@Override
protected void onStop() {
// TODO Auto-generated method stub
super.onStop();
}
protected void OnActivityResult(int requestCode,int resultCode,Intent data){
}
}
=======================================
SchoolAppActivity.java(main)
=======================================================
package js.schoolapp;
import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
public class SchoolAppActivity extends Activity implements android.view.View.OnClickListener{
Button OneButton,TwoButton,ThreeButton,FourButton;
//static boolean TF=true;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
Loading();
OneButton = (Button)findViewById(R.id.one);
TwoButton = (Button)findViewById(R.id.two);
ThreeButton = (Button)findViewById(R.id.three);
FourButton = (Button)findViewById(R.id.four);
OneButton.setOnClickListener(this);
TwoButton.setOnClickListener(this);
ThreeButton.setOnClickListener(this);
FourButton.setOnClickListener(this);
}
public void onClick(View v) {
Intent intent;
if(v.getId() == R.id.one)
{
intent = new Intent(SchoolAppActivity.this,intro.class);
startActivity(intent);
}
else if(v.getId() == R.id.two)
{
intent = new Intent(SchoolAppActivity.this,position.class);
startActivity(intent);
}
else if(v.getId() == R.id.three)
{
Uri uri = Uri.parse("http://google.co.kr");
intent = new Intent(Intent.ACTION_VIEW,uri);
startActivity(intent);
}
else if(v.getId() == R.id.four)
{
}
}
public void Loading()
{
//if(TF==true){
startActivity(new Intent(this, Loding.class));
//TF=false;
//}
}
}
=======================================




Activity 생성주기를 잘 모르는 상태이시군요...
Activity의 생성주기에서 Activity가 실행되기까지의 과정에서
onResume()도 들어있습니다.
대충 쭉 훑어보니 어플이 실행되면 다음 엑티비티로 넘어가는
동작이 연속으로 두번 호출되네요.
그리고 다시 어플을 실행시켰을때 로딩화면부터 나오는 부분은
어플의 시작이 로딩페이지이고 로딩후에 넘어가게만 해놓으면
자연스럽게 해결되는 부분입니다.