title: Accessing textview of another View in Android
body: <p>I hope someone have answer to this. I have one View called main.xml, that view is using one more view list_item.xml and, like ataching some information to main.xml where is some list etc.. Now, in that list_item.xml I have TextView that I want to change color with change of its content... So I'm ok with getting content of that textview, but I cannot access to that textview to change color..Everything is happening in one activity..This is part of a code in that activity:</p>
  
  <pre><code>public void onCreate(Bundle savedInstanceState) {
  
  
      Toast.makeText(getBaseContext(), "Zadaci se učitavaju...", Toast.LENGTH_LONG).show();
      getWindow().requestFeature(Window.FEATURE_NO_TITLE);
      getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
      super.onCreate(savedInstanceState);
      setContentView(R.layout.main);
  
      //PROVERA KONEKCIJE
       CheckConnectivity check = new CheckConnectivity();
       Boolean conn = check.checkNow(this.getApplicationContext());
       if(conn == true){
  
      ArrayList&lt;HashMap&lt;String, String&gt;&gt; menuItems = new ArrayList&lt;HashMap&lt;String, String&gt;&gt;();
  
      XMLParser parser = new XMLParser();
      String xml = parser.getXmlFromUrl(URL); // getting XML
      Document doc = parser.getDomElement(xml); // getting DOM element
  
      NodeList nl = doc.getElementsByTagName(KEY_OBAV);
      // looping through all item nodes &lt;item&gt;
  
      TextView tvv = (TextView)findViewById(R.id.prioritet);
      int num = 1;   
      String str = String.valueOf(num);
  
      for (int i = 0; i &lt; 5; i++) {
          // creating new HashMap
          HashMap&lt;String, String&gt; map = new HashMap&lt;String, String&gt;();
          Element e = (Element) nl.item(i);
  
          // adding each child node to HashMap key =&gt; value
  
          map.put(KEY_PROF, parser.getValue(e, KEY_PROF));
          map.put(KEY_PRE, parser.getValue(e, KEY_PRE));
          map.put(KEY_TXT, parser.getValue(e, KEY_TXT));
          map.put(KEY_VRE, parser.getValue(e, KEY_VRE));
          map.put(KEY_PRI, parser.getValue(e, KEY_PRI));
          map.put(KEY_ATA, parser.getValue(e, KEY_ATA));
          menuItems.add(map);
  
          if((parser.getValue(e, KEY_PRI)).equalsIgnoreCase(str)){
  
              tvv.setBackgroundResource(R.color.somecolor);
              System.out.println((parser.getValue(e, KEY_PRI)).toString());
  
              }
  
  
      // Adding menuItems to ListView
      ListAdapter adapter = new SimpleAdapter(this, menuItems,
              R.layout.list_item,
              new String[] { KEY_PROF, KEY_PRE, KEY_TXT, KEY_VRE, KEY_PRI, KEY_ATA}, new int[] {
                      R.id.profesor,R.id.vreme, R.id.tekst, R.id.predmet, R.id.prioritet, R.id.atachment });
  
      setListAdapter(adapter);
  
  
  
  
  
  
      }
  </code></pre>
  
  <p>And this is list_item.xml, where I need to access that textview called "prioritet":</p>
  
  <pre><code>    &lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="fill_parent"
      android:layout_height="wrap_content"
      android:orientation="horizontal"
      android:background="@color/bordo"&gt;
  
      &lt;LinearLayout
          xmlns:android="http://schemas.android.com/apk/res/android"
          android:layout_width="fill_parent"
          android:layout_height="wrap_content"
          android:orientation="vertical"&gt;
  
          &lt;/LinearLayout&gt;
  
          &lt;TextView
              android:id="@+id/prioritet"
              android:layout_width="210dp"
              android:layout_height="15dp"
              android:layout_marginLeft="90dp"
              android:layout_marginTop="10dp"
              android:background="@color/bordot"
              android:gravity="left"
              android:textColor="#acacac"
              android:textStyle="bold" /&gt;
  
          &lt;TextView
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:layout_marginTop="-20dp"
              android:background="@color/bordot"
              android:gravity="left"
              android:text="Prioritet:"
              android:textColor="@color/bela"
              android:textSize="15dip"
              android:textStyle="bold" /&gt;
  
          &lt;TextView
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:layout_marginTop="10dp"
              android:background="@color/bordot"
              android:gravity="left"
              android:text="Atachment:"
              android:textColor="@color/bela"
              android:textSize="15dip"
              android:textStyle="bold" /&gt;
  
          &lt;TextView
              android:id="@+id/atachment"
              android:layout_width="210dp"
              android:layout_height="15dp"
              android:layout_marginLeft="90dp"
              android:layout_marginTop="-15dp"
              android:background="@color/bordot"
              android:gravity="left"
              android:textColor="#acacac"
              android:textStyle="bold" /&gt;
  
          &lt;LinearLayout
              xmlns:android="http://schemas.android.com/apk/res/android"
              android:layout_width="fill_parent"
              android:layout_height="3dp"
              android:layout_marginTop="10dp"
              android:background="@color/crvena"
              android:orientation="horizontal" &gt;
  
          &lt;/LinearLayout&gt;
  
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>So, what I want is just, when is inside of textview "prioritet" number 1 to be one color of that textview, when is number 2 other and so on...
  I know that I can not just access because of the view, that is main...I tried with inflating..didn't work..Any help is appreciated. </p>