Hi! am Suman. I have a code by which i can access all the sms from
inbox. The code is written below.
import android.app.ListActivity;
import android.content.ContentUris;
import android.content.Intent;
import android.database.Cursor;
import android.net.Uri;
import android.os.Bundle;
import android.provider.Contacts.People;
import android.provider.Telephony.Carriers;
import android.telephony.gsm.SmsMessage;
import android.view.View;
import android.widget.ListAdapter;
import android.widget.ListView;
import android.widget.SimpleCursorAdapter;
public class niceandroid8 extends ListActivity {
private ListAdapter mAdapter;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
Uri uri = Uri.parse("content://sms/inbox");
Cursor c = getContentResolver().query(uri, null, null,
null,null);
// Cursor c = getContentResolver().query(Carriers.CONTENT_URI,
null, null, null, null);
startManagingCursor(c);
String[] columns = new String[]{"body"}; // Comment
int[] names = new int[]{R.id.row_entry};
mAdapter = new SimpleCursorAdapter(this, R.layout.con1, c,
columns, names);
this.setListAdapter(mAdapter);
}
}
xml coding is..........
<?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="Sms: "
/>
<TextView
android:id="@+id/row_entry"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
</LinearLayout>
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Now my problem is i want to access those sms which have a specific
string . As a example ....
if any sms contains "Hello". So i want to search the string. i have
tried a lot. But i cant do this beacause i cant convert the
Listadapter to String. Please help me and give me the correct code.
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---