im new in android and java & i have this intent
String temp = intent.getStringExtra("msg");
and it return multiple word continuously like "msg a" , "msg b" , "msg c" ...and i want to store all these words to another string
this is what i tried
String anothertemp = temp;
but the problem is it just store last word "msg c". i mean it will replace and overwrite new word with old words
i want to store all these words in one new string and each word in new line like this
msg a
msg b
msg c
by the way i allready tried these too
String temp = intent.getStringExtra("msg")+ "\n" ;
&
String anothertemp = temp+ "\n";
still have the same problem. sorry for my poor english
EDIT ONE
this is my intent
class NLServiceReceiver extends BroadcastReceiver{
@Override
public void onReceive(Context context, Intent intent) {
if(intent.getStringExtra("command").equals("list")){
int i=1;
for (StatusBarNotification sbn : NLService.this.getActiveNotifications()) {
Intent i2 = new Intent("notificationmsg");
i2.putExtra("msg",i +" " + sbn.getPackageName() + "\n");
sendBroadcast(i2);
i++;
}
}
}
}
and this is how i call it
class NotificationReceiver extends BroadcastReceiver{
@Override
public void onReceive(Context context, Intent intent) {
String temp = intent.getStringExtra("msg") + "\n";
String anothertemp = temp;
}
}
Edit two
consider that we have 3 notification "msg1","msg2" and "msg3" ,in method onReceive in the NotificationReceiver class will post the string one by one (one after another )when the msg1 string posted then it will post msg2 string. it wont post all this msg's together in same time .. and this is what will happened ; it will post notification msg 1 string and then will post msg2 string and it will be replace and overwrtie on msg 1 ,,and then it will post msg 3 and it will be replace and overwrite on msg2...so in the end i only can get msg 3 string...
thanks for any help