안녕하세요 현제 안드로이드 공부중인데요
제가만드는게 인텐트에서 인텐트로 Extra로 데이터넘기는건데요
처음에 1번 엑티비티에 a라는 데이터를 넘겨주면 a를 잘받아오는데요
그다음에 종료하지않고 다시 b라는 데이터를 넘겨주면
인텐트에 데이터가 그대로 a가 남아있더라구요
계속 넘겨주는거에따라 데이터를 바꿀수없을까요??
답변부탁드립니다!
----인텐트 호출하는 소스입니다
private static void generateNotification(Context context, String message,String param,String param1) {
Log.e("process","Noti 3"+param);
int icon = R.drawable.ic_launcher;
long when = System.currentTimeMillis();
NotificationManager notificationManager = (NotificationManager) context
.getSystemService(Context.NOTIFICATION_SERVICE);
Notification notification = new Notification(icon, message, when);
notification.vibrate = new long[] { 150, 100, 150, 100 };
notification.defaults |= Notification.DEFAULT_SOUND;
String title = context.getString(R.string.app_name);
Intent notificationIntent = new Intent(context, RedirectActivity.class);
notificationIntent.putExtra("param", param);
notificationIntent.putExtra("param1", param1);
notificationIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP
| Intent.FLAG_ACTIVITY_SINGLE_TOP);
PendingIntent intent = PendingIntent.getActivity(context, 0,
notificationIntent, 0);
notification.setLatestEventInfo(context, title, message, intent);
notification.flags |= Notification.FLAG_AUTO_CANCEL;
notificationManager.notify(0, notification);
}
--------받는 엑티비티 소스입니다
package com.xenixstudio.kepco;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
public class RedirectActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.redirect_layout);
}
@Override
protected void onResume() {
// TODO Auto-generated method stub
super.onResume();
Intent intent = getIntent();
String param = intent.getExtras().getString("param");
Log.e("Redi Param",param);
String param1 = intent.getExtras().getString("param1");
if(param.equals("home")){
Intent redirect = new Intent(RedirectActivity.this,HomeActivity.class);
startActivity(redirect);
}else{
Intent redirect = new Intent(RedirectActivity.this,CounselActivity.class);
redirect.putExtra("param",param);
redirect.putExtra("param1",param1);
startActivity(redirect);
}
}
}