2012-01-20 39 views
0

我正在開發一個與消息相關的應用程序。如何在我的應用程序中知道我何時發送新消息?

在我的應用程序中,我使用contentresolver獲取所有發送的消息。

代碼

c = getContentResolver().query(SMS_sent,null, null, null, null); 

     startManagingCursor(c); 
if(c!=null) 
     { 

     ((LinearLayout)findViewById(R.id.linearLayout11)).setVisibility(View.GONE); 

     String columns ="body"; 
      String columns1 = "address"; 

     SimpleCursorAdapter adapter2 = new SimpleCursorAdapter(this, R.layout.main2,c, 
        new String[] {columns1,columns}, new int[]{R.id.textView2, R.id.textView4}); 
        ListView empListView = (ListView)findViewById(R.id.listView1); 
        empListView.setAdapter(adapter2); 
} 

它工作正常。

我的要求是,當我發送新郵件,

我想hanlde,在我的應用程序。

如果任何人知道解決的辦法,請大家幫我

在此先感謝

回答

0

你可以談論廣播接收機。

您可以爲此目的製作broadcastreceiver。

關於消息的廣播在andorid os中可用。

嘗試搜索。

+0

卜使用brodcast resevers U將得到的信息接收華南簡介我sms.but想知道發來的短信。 – kiran

+0

對不起,我錯過了。因爲我知道這是沒有辦法的。如果你製作了一個控制短信的應用程序。活動選擇器會提示用戶使用哪個應用程序。並且用戶選擇你的應用程序,並且用戶嘗試製作新的短信,你的應用程序將會被調用。 – lulumeya

相關問題