I have a listview class.listview opening and a user can click any listview item. I wanna set the text on a xml. I have strings like st1-st2-st3. If I clicked any listview item, how can I get it to open the xml and set Textview1 for st1/@String ?
my listview working like this ;
public class strateji extends Activity {
private static final String LOG_TAG = "Alert Dialog Activity";
private ListView lv1;
private TextView status;
private String lv_arr[]={"listview1-list2-list3-list4-list5-list6-etc..."};
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.ana);
// Look up the AdView as a resource and load a request.
Log.i(LOG_TAG, "Alert Dialog Activity Started");
lv1=(ListView)findViewById(R.id.listView1);
// By using setAdpater method in listview we an add string array in list.
lv1.setAdapter(new ArrayAdapter<String>(this,android.R.layout.simple_list_item_1 , lv_arr));
lv1.setOnItemClickListener(new OnItemClickListener() {
public void onItemClick(AdapterView<?> parent, View view,
int position, long id) {
if(position == 0)
{
setContentView(R.layout.texts); //--->opening texts.xml and setText
status.setText(String);--------->>> like this i want send a string for TextView
}
if(position == 1)
{
Intent myIntent = new Intent(strateji.this, mat2.class);
startActivityForResult(myIntent, 0);
}
}
}