1
我想在MainActivity
和BroacastReceviever
之間進行通信。getIntent()在第一個主要活動中返回什麼?
當一條消息到來時,在MainActivity
中,應該有圖標上的動畫。所以當我收到消息時,我就開始主要活動。但我無法處理動畫。
還有就是我下面主要業務代碼:
Intent intent = getIntent();
Toast.makeText(this, "wow", Toast.LENGTH_SHORT).show();
if(intent.getStringExtra("receive").equals("success"))
InitBadge();
還有就是我對收到如下方法代碼廣播:
public void onReceive(Context context, Intent intent)
{
Intent newintent = new Intent(context.getApplicationContext(),MainActivity.class);
newintent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
// newintent.setFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
newintent.putExtra("receive", "success");
// newintent
context.startActivity(newintent);
}
什麼你的代碼有問題嗎? InitBadge()不會被執行或其他什麼? – 2014-08-30 11:34:57