Advertisement
ChocoMan

Untitled

Jun 13th, 2012
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.23 KB | None | 0 0
  1.  
  2. //CUSTOMADAPTER CLASS
  3. /** 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:*/
  4.  
  5. holder.contact
  6. // part of my getView() method in my CustomAdapter class
  7.  
  8. holder.contact = (TextView) findViewById(R.id.contacts);
  9. holder.photo = (ImageView) findViewById(R.id.contactPhoto);
  10.  
  11. String folder = "content://sms/inbox/";
  12.             Uri mSmsQueryUri = Uri.parse(folder);
  13.             contactID = new ArrayList<String>();
  14.             SMS = new ArrayList<String>();
  15.  
  16.             try {
  17.                 c = context.getContentResolver().query(mSmsQueryUri,
  18.                         new String[] { "_id", "address", "date", "body" },
  19.                         null, null, null);
  20.                 if (c == null) {
  21.                     Log.i(TAG, "cursor is null. uri: " + mSmsQueryUri);
  22.                 }
  23.  
  24.                 c.moveToFirst();
  25.                 while (c.moveToNext()) {
  26.    
  27.                     phoneNumber = c.getString(0);
  28.                     contactID.add(phoneNumber);
  29.                 }
  30.  
  31.             } catch (Exception e) {
  32.                 //Log.e(TAG, e.getMessage());
  33.             } finally {
  34.                 c.close();
  35.             }
  36.          
  37.        if(holder != null){
  38.          holder.contacts.(contactID.get(position); // adds each contact to the list
  39.          holder.photo.????   // this is the problem child
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement