[android-developers] SMS inbox Read Problem

2010-02-18 Thread Akage
Hi Thank you for Read this thread.

i tryed for apps  sms blocker

first i get sms inbox message like this

public class CsmsHandler extends BroadcastReceiver {
   public void onReceive(Context arg0, Intent arg1) {
   Bundle bundle = arg1.getExtras();
   SmsMessage[] msgs = null;
   String str = ;
  if (bundle != null){
  Object[] pdus = (Object[]) bundle.get(pdus);
  msgs = new SmsMessage[pdus.length];
for (int i=0; imsgs.length; i++){
msgs[i] =
SmsMessage.createFromPdu((byte[])pdus[i]);
   str += SMS from  +
msgs[i].getOriginatingAddress();
   str +=  :;
   str += msgs[i].getMessageBody().toString();
   str += \n;
}

Toast.makeText(arg0, str, Toast.LENGTH_SHORT).show();
main.instance.viewSmsList();  mark
}
}
--  mark is ListActivity List refresh from smsinbox

DDMS send to sms recieve event and refresh List very well
but last messeage is not view  in list

how can process last message into list?

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] SMS inbox

2010-01-19 Thread abhi
How do I access the SMS inbox in android? I am able to receive new
messages. However I could not find a straightforward tutorial on
accessing the SMS inbox. I know I have to use content provider.

If you know how to use content provider to access SMS inbox, please
let me know. Thanks.
-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] SMS inbox and Simple cursor adapter.

2009-06-15 Thread miguel

Hi to all,

Im trying to read the sms inbox with getContentResolver() , and the
create a list of all messages with SimpleCursorAdapter. I can read
fine all the fields with the cursor methods, but when I try create a
list of sms bodies with SimpleCursorAdapter, the list appears(with the
correct number of rows), but it´s void.

Any help would be apreciated.
Thanks in advance.



.java file:

Public class smsInbox extends ListActivity {

private ListAdapter mAdapter;

/** Called when the activity is first created. */
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);

String SORT_ORDER = date DESC;
String SMS_READ_COLUMN = read;
int count = 0;

Cursor cursor = getContentResolver().query(Uri.parse
(content://sms/inbox),
new String[] { _id, thread_id, address, person,
date, body },
null,null,SORT_ORDER);

startManagingCursor(cursor);

String[] columns = new String[]{body};
int[] names = new int[] {R.id.row_entry};

mAdapter = new SimpleCursorAdapter(this, R.layout.main,
cursor, columns, names);
setListAdapter(mAdapter);

}
 }
--


main.xml
---
?xml version=1.0 encoding=utf-8?
LinearLayout xmlns:android=http://schemas.android.com/apk/res/
android
android:orientation=vertical
android:layout_width=fill_parent
android:layout_height=fill_parent

TextView id=@+id/row_entry
android:layout_width=wrap_content
android:layout_height=wrap_content
/
/LinearLayout
---

Miguel.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] SMS Inbox: 2008's toughest problem ( At least for me)

2008-12-30 Thread ipeg . student

###
Please help me access the list of sms in the inbox. I am using this
code, please let me know what is wrong, it always gives a n unexpected
error popup in the emulator.


I used a similar code for accessing the contacts list ( People.NAME
etc ), it worked fine. However, I cannot do it for SMS inbox.

Thanks in advance and happy new year!
###
package org.anddev.android.hello;

import android.app.ListActivity;
import android.database.Cursor;
import android.os.Bundle;
import android.provider.Telephony.Sms;
import android.widget.ListAdapter;
import android.widget.SimpleCursorAdapter;

public class HelloAndroid extends ListActivity {

 private ListAdapter mAdapter;

  /** Called when the activity is first created. */
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
Cursor c = getContentResolver().query(Sms.Inbox.CONTENT_URI,
null, null, null, null);//.query(Sms.CONTENT_URI, null, null, null,
null);
startManagingCursor(c);
String[] columns = new String[]{Sms.Inbox.READ};
int[] names = new int[]{R.id.row_entry};
mAdapter = new SimpleCursorAdapter(this, R.layout.main, c,
columns, names);

this.setListAdapter(mAdapter);
}

 }
###

Here is the main.xml code

?xml version=1.0 encoding=utf-8?
LinearLayout xmlns:android=http://schemas.android.com/apk/res/
android
android:orientation=horizontal
android:layout_width=fill_parent
android:layout_height=wrap_content

TextView
android:layout_width=wrap_content
android:layout_height=wrap_content
android:text=Name: 
/
TextView
android:id=@+id/row_entry
android:layout_width=wrap_content
android:layout_height=wrap_content
/
/LinearLayout

#
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---