title: R.id cannot be resolved or is not a field.
body: <p>This is a simple code to show a simple listview with images and text. its giving two errors. 
   at statement,  </p>
  
  <pre><code>int[] to = { R.id.flag,R.id.txt}; //error: flag cannot be resolved or is not a fied
  lv = ( ListView ) findViewById(R.id.listview); //error: listview cannot be resolved or is not a field. 
  </code></pre>
  
  <p>hope you will accomodate me!
  regards</p>
  
  <pre><code> package com.example.amjad_3;
  
      import java.util.ArrayList;
      import java.util.HashMap;
      import java.util.List;
  
      import android.app.Activity;
      import android.os.Bundle;
      import android.widget.ListView;
      import android.widget.SimpleAdapter;
  
      public class MainActivity extends Activity {
  
       // Array of strings storing country names
       String[] countries = new String[] {
          "India",
          "Pakistan",
          "Sri Lanka",
          "China",
          "Bangladesh",
          "Nepal",
          "Afghanistan",
          "North Korea",
          "South Korea",
          "Japan"
          };
  
      // Array of integers points to images stored in /res/drawable-ldpi/
          int[] flags = new int[]{
          R.drawable.india,
          R.drawable.pakistan,
          R.drawable.srilanka,
          R.drawable.china,
          R.drawable.bangladesh,
          R.drawable.nepal,
          R.drawable.afghanistan,
          R.drawable.nkorea,
          R.drawable.skorea,
          R.drawable.japan
          };
  
         // Array of strings to store currencies
  
          ListView lv;
         /** Called when the activity is first created. */
         @Override
          public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
  
          // Each row in the list stores country name, currency and flag
          List&lt;HashMap&lt;String,String&gt;&gt; aList = new ArrayList&lt;HashMap&lt;String,String&gt;&gt;();
  
            for(int i=0;i&lt;10;i++){
              HashMap&lt;String, String&gt; hm = new HashMap&lt;String,String&gt;();
              hm.put("txt", "Country : " + countries[i]);
  
              hm.put("flag", Integer.toString(flags[i]) );
              aList.add(hm);
          }
  
          // Keys used in Hashmap
          String[] from = { "flag","txt","cur" };
  
          // Ids of views in listview_layout
          int[] to = { R.id.flag,R.id.txt};
  
          // Instantiating an adapter to store each items
          // R.layout.listview_layout defines the layout of each item
            SimpleAdapter adapter = new SimpleAdapter(getBaseContext(), aList,          R.layout.listview, from, to);
  
          // Getting a reference to listview of main.xml layout file
          lv = ( ListView ) findViewById(R.id.listview); 
  
          // Setting the adapter to the listView
          lv.setAdapter(adapter);
      }
  }
  </code></pre>