Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //CUSTOMADAPTER CLASS
- /** The contacts are already in an ArrayList<String> from another class, then passed into this class through a constructor. The following code allows me to see the list of contacts that has sent me an SMS:*/
- holder.contact
- // part of my getView() method in my CustomAdapter class
- holder.contact = (TextView) findViewById(R.id.contacts);
- holder.photo = (ImageView) findViewById(R.id.contactPhoto);
- String folder = "content://sms/inbox/";
- Uri mSmsQueryUri = Uri.parse(folder);
- contactID = new ArrayList<String>();
- SMS = new ArrayList<String>();
- try {
- c = context.getContentResolver().query(mSmsQueryUri,
- new String[] { "_id", "address", "date", "body" },
- null, null, null);
- if (c == null) {
- Log.i(TAG, "cursor is null. uri: " + mSmsQueryUri);
- }
- c.moveToFirst();
- while (c.moveToNext()) {
- phoneNumber = c.getString(0);
- contactID.add(phoneNumber);
- }
- } catch (Exception e) {
- //Log.e(TAG, e.getMessage());
- } finally {
- c.close();
- }
- if(holder != null){
- holder.contacts.(contactID.get(position); // adds each contact to the list
- holder.photo.???? // this is the problem child
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement