마스터Q&A 안드로이드는 안드로이드 개발자들의 질문과 답변을 위한 지식 커뮤니티 사이트입니다. 안드로이드펍에서 운영하고 있습니다. [사용법, 운영진]

dialog호출시 이전 activity도 같이 보이네요. [closed]

0 추천

안녕하세요.

gcm 알림창 테스트 중 이상동작이 발생하여 찾아보는데 해결책이 떠오르지 않아 글남깁니다^^;

상황.

 앱실행-> 홈버튼->gcm 메시지 수신-> 팝업뷰 호출 ( 이때 홈화면에서 알림이 뜨는게 아니라 마지막에 홈버튼 눌렀을때의 액티비리를 같이 호출해 줍니다...;)

GCM 메시지 받는 부분( 팝업뷰 호출. )  
Intent popupIntent = new Intent(getBaseContext(), DisplayPopup.class)
     .setFlags(Intent.FLAG_ACTIVITY_NEW_TASK
       | Intent.FLAG_ACTIVITY_CLEAR_TOP
       );
   
   popupIntent.putExtra("MSG", message);
   popupIntent.putExtra("MSG_ID", message_id);
   startActivity(popupIntent);

 

팝업뷰 (dailog로 내용 나타냄)

public class DisplayPopup extends Activity {

 private DisplayPopupDialog mDialog;
 @Override
 protected void onCreate(Bundle savedInstanceState) {
  // TODO Auto-generated method stub
  super.onCreate(savedInstanceState);

  requestWindowFeature(Window.FEATURE_NO_TITLE);
  getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));

 // //화면 잠겨 있을때 보여주기
   getWindow().addFlags(
   WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED
   | WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD
   | WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON
   | WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON);
   
   mDialog = new DisplayPopupDialog(this, getIntent()
    .getStringExtra("MSG"), listener);

  mDialog.show();
    
 }

 
다이얼로그 부분
public class DisplayPopupDialog extends Dialog {

 /**
  * @uml.property name="message"
  */
 private String message;


 /**
  * @uml.property name="tv_message"
  * @uml.associationEnd
  */
 private TextView tv_message;
 private View.OnClickListener listenter;
 Button btn_ok, btn_cancel;

 public DisplayPopupDialog(Activity act, String message,
   View.OnClickListener listenter) {
  super(act);

  this.message = message;
  this.listenter = listenter;

 }

 @Override
 protected void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);

   new ContextThemeWrapper(getContext(), android.R.style.Theme_Translucent_NoTitleBar);

  requestWindowFeature(Window.FEATURE_NO_TITLE);
  getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
  setContentView(R.layout.display_popup1);
  
 }
}

여기저기 찾아보니

투명액티비티? 에 다이얼로그를 띄우면 문제없이 된다고 하던데 왜 안될까요..;;;

단순히 팝업뷰만 호출을 해주는데 왜 마지막 액티비티가 같이 딸려오는지 ;;

 

추가로 앱을 종료 했을때는 이상없이 홈화면위에 제대로 표시 됩니다.

 

조그마한 조언이라두 감사합니다^^

 

질문을 종료한 이유: 해결
나랏말 (160 포인트) 님이 2013년 7월 31일 질문
나랏말님이 2013년 7월 31일 closed

1개의 답변

0 추천
자답 :
            android:launchMode="singleInstance"
나랏말 (160 포인트) 님이 2013년 7월 31일 답변
...