title: Custom SimpleAdapter only shows Sample Text Android
body: <p>Before making my own SimpleAdapter object because I wanted to change the color of the rows, I was just using new SimpleAdapter(...). Now that I am using my own custom SimpleAdapter, the row color is changing, but my text is not getting updated. I have called adapter.notifyDataSetChanged(), but it is still showing only the sample text- "TextView". As I said, everything was working fine when I didn't create my own adapter. I suspect it might have something to do with the order I am initializing things:</p>
  
  <pre><code>public class AddScreen extends Activity implements OnClickListener,
      OnItemClickListener, OnItemLongClickListener {
  SimpleAdapter adapter;
  List&lt;HashMap&lt;String, String&gt;&gt; painItems = new ArrayList&lt;HashMap&lt;String, String&gt;&gt;();
  ListView listthings;
  int[] to;
      String[] from;
  
  public void onCreate(Bundle savedInstanceState) {
  ...
  listthings = (ListView) findViewById(R.id.listthings);
      from = new String[] { "row_1", "row_2" };
      to = new int[] { R.id.row1, R.id.row2 };
  
      adapter = new Adapter(this, painItems, R.layout.mylistlayout,
              from, to);
  
      listthings.setAdapter(adapter);
  ...
  }
  
  public class Adapter extends SimpleAdapter{
      HashMap&lt;String, String&gt; map = new HashMap&lt;String, String&gt;();
      public Adapter(Context context, List&lt;? extends Map&lt;String, String&gt;&gt; data,
              int resource, String[] from, int[] to) {
          super(context, data, resource, from, to);
  
      }
  @Override
      public View getView(int position, View convertView, ViewGroup parent){
          View row = convertView;
          if (row == null) {
              LayoutInflater mInflater = (LayoutInflater)getSystemService(Context.LAYOUT_INFLATER_SERVICE);
              row = mInflater.inflate(R.layout.mylistlayout, parent, false);
              }
          row.setBackgroundColor(0xFF0000FF);
         TextView rw1 = (TextView)findViewById(R.id.row1);
        // TextView rw2 = (TextView)findViewById(R.id.row2);
         rw1.setText(map.get(position));
         return row;
      }
  
  }
  // to add the item, put it in the map, and add the map into the list
  private void addItem() {
      HashMap&lt;String, String&gt; map = new HashMap&lt;String, String&gt;();
      map.put("row_1", row1);
      map.put("row_2", row2);
      map.put("row_3", painLevelString);
      map.put("row_4", painLocation);
      map.put("row_5", timeOfPainString);
      map.put("row_6",textTreatmentString);
      painItems.add(map);
  
          adapter.notifyDataSetChanged();
  
  
  
  
  }
  </code></pre>
  
  <p><strong>EDIT:Added Code</strong></p>
  
  <p>This is how I am getting the data from the intent(onActivityResult()), placed before the addItem Code:</p>
  
  <pre><code>protected void onActivityResult(int requestCode, int resultCode, Intent data) {
      if (resultCode == 1) {
          row1 = data.getStringExtra("com.painLogger.row1");
          row2 = data.getStringExtra("com.painLogger.row2");
  
          painLevelString = data.getStringExtra("com.painLogger.painLevel");
          painLocation = data.getStringExtra("painLocation");
          timeOfPainString = data.getStringExtra("com.painLogger.painTime");
          textTreatmentString = data
                  .getStringExtra("com.painLogger.treatment");
          addItem();
      }
  }
  </code></pre>
  
  <p><em><strong></em>*Also, just in case this is relevant the order of placement is this: onCreate() -> custom Adapter class -> onActivityResult() -> addItem()* **</strong></p>
  
  <p>Here is a screenshot of what it looks like. The two TextView fields in each item should be filled with info(which they were, until I did this). </p>