Question: I am trying to give a value of char array field of a struct to an an element of another struct array.

```
struct Node {
   char template_id[6];
};
struct Node1
{
   char *template_id;
}
void main()
{ 
   Node1 *temp;
   temp_counter=0;
   temp=malloc(5*sizeof(Node1));
   temp[temp_counter].template_id=cur_node->template_id; //getting seq error here
} 

```

Tried the followings:

```
strcpy(temp[temp_counter].template_id,cur_node->template_id);
strncpy(temp[temp_counter].template_id,cur_node->template_id,6);

```

Still seq error.
`cur_node` is initialized in different place and it is ok.
Tried the following:

```
temp[temp_counter].template_id="hello"; // It works though

```

Answer: 
The issue that you're changing the displayed view, but not the underlying data. When the adapter needs to recreate the view, it uses the data which hasn't changed.

Given that, the best approach is to change the data and tell the adapter to update, rather than changing the views themselves.

Add a changeable list and use it in the adapter:

```
ArrayList<String> displayed;

// in loadActivity
displayed = new ArrayList<String>(Arrays.asList(capital));
setListAdapter(new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, displayed));

```

Then change the data when a list item's clicked and notify the adapter:

```
// In onListItemClick
if (displayed.get(position).equals(answer[position])) {
    displayed.set(position, capital[position]);
} else {
    displayed.set(position, answer[position]);
}
((ArrayAdapter) getListAdapter()).notifyDataSetChanged();

```
I'm fairly new to android and not sure if this is the standard way of solving this, but I have solved this problem by storing the selected state of your element(s) in a field. When you scroll, check the state of your button and if it should be selected, perform whatever actions you wish on it (Highlighting it, changing its text, clicking it, etc.)