안녕하세요. 날씨가 많이 풀렸네요.

 

다름이 아니라 궁금한게 있어서 질문드립니다.

 

우선 소스코드 먼저 보여드리겠습니다.

 

//구글에 GCM서버로 부터 메시지를 받았을 때 펜딩인텐트를 이용해서 NotiPopup을 호출합니다.

// receiveMsg.class

-------

Bundle bun = new Bundle();
bun.putString("iconType", icontype); //아이콘 타입을 넘김.

Intent popupIntent = new Intent(context.getApplicationContext(), NotiPopup.class);

popupIntent.putExtras(bun);

PendingIntent pie = PendingIntent.getActivity(context.getApplicationContext(), 0, popupIntent, PendingIntent.FLAG_ONE_SHOT);
            
           try {
             
             pie.send();
            
            } catch (Exception e) {
              Log.i("test","exception");
            }          

 

------

// 아이콘 타입값이 머냐에 따라서 팝업의 아이콘을 설정을 해주려고 하는데 에러가 나버리네요.

// NotiPopup.class

....

...

setContentView(R.layout.popup2);

Bundle bun = getIntent().getExtras();

final String iconType = bun.getString("iconType");

ImageView imgView = (ImageView)findViewById(R.id.imageView1);

 

if(iconType != null && "".equals(iconType))
  {
   if("link".equals(iconType)) //iconType값이 link일때
   {    
    imgView.setImageDrawable(getApplicationContext().getResources().getDrawable(R.drawable.linkicon));
    Log.i("test","링크아이콘으로 설정.");
   }
   else if("market".equals(iconType)) //iconType값이 link일때
   {
    imgView.setImageDrawable(getApplicationContext().getResources().getDrawable(R.drawable.marketicon));
    Log.i("test","마켓아이콘으로 설정");
   }
   else
   {
    //imgView.setImageDrawable(getApplicationContext().getResources().getDrawable(R.drawable.ans));
   }    
  }

 

 

--------

위와같이 iconType이 머냐에 따라서 팝업아이콘을 그때 그때마다 바꿔 주고 싶은데

실상 돌리면 에러가 나네요. 어떻게 해봐야 될까요?