Arehexes
Well-Known Member
Ok so I looked around and didn't see much on this but I'm getting this problem with my code
The problem is this line right here
list=(ListView)findViewById(R.id.listView1);
which gives me a Cannot cast from View to ListView and I checked the xml file and it is a ListView so I don't know what the deal is. I was wondering if anyone knew
Code:
public class ListView extends Activity {
String [] test=new String[100];
ListView list;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.relative);
for(int i=0; i<test.length; i++){
test[i]="Line" +(""+(i+1));
}
list=(ListView)findViewById(R.id.listView1);
ArrayAdapter adapt=new ArrayAdapter<String> (this, R.layout.textlist, test);
}
}
The problem is this line right here
list=(ListView)findViewById(R.id.listView1);
which gives me a Cannot cast from View to ListView and I checked the xml file and it is a ListView so I don't know what the deal is. I was wondering if anyone knew