[Android]
2010/07/22 15:56
Broadcast와 같이 activity를 상속받지 않는 class인 경우,
이 파일 내에서는 startActivity(intent)가 먹히지 않는다;
여기서는 PendingIntent를 사용
————————————————————————————————————————
Intent i = new Intent( mContext, 보낼클래스이름.class );
PendingIntent pi =
PendingIntent.getActivity(mContext, 0, i, PendingIntent.FLAG_ONE_SHOT);
try { Toast.makeText(mContext, str, 0).show(); pi.send(); } catch (CanceledException e) { e.printStackTrace(); }————————————————————————————————————————-
PendingIntent.getActivity(...) 말고도 PendingIntent.getBroadcast(...), PendingIntent.getService(...) 가 있다.
PendingIntent 객체를 얻어올때 getActivity(...)를 사용하고 있는데 이는 액티비티를 실행하라는 의미를 지닌다. (context.startActivity(...)와 비슷..)
Trackback Address:http://odin.80port.net/blog2/hstech/trackback/318
