Hi friends,
I have 2 edittexts ,ontouch of the first edittext it should a particular
listview and ontouch of second edittext it should show a different
listview in android.
I have used the below code
View currentView = linflater.inflate(R.layout.listview, null);
list1 =(ListView)currentView.findViewById(R.id.list);
View previousView = linflater.inflate(R.layout.listview1, null);
list2 =(ListView)previousView.findViewById(R.id.list);
edit1.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
list1.setVisibility(View.VISIBLE);
list2.setVisibility(View.INVISIBLE);
listView.removeView(currentView);
linearlayout.removeView(previousView);
linearlayout.removeView(previousView);
String[] names = new String[] { "Linux", "Windows7",
"Eclipse", "Suse",
"Ubuntu", "Solaris", "Android", "iPhone"};
// Create an ArrayAdapter, that will actually make the
Strings above
// appear in the ListView
list1.setAdapter(new ArrayAdapter<String>(SearchClass.this,
android.R.layout.simple_list_item_1, names));
linearlayout.addView(currentView);
return false;
}
});
edit1.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
list1.setVisibility(View.INVISIBLE);
linearlayout.removeView(previousView);
linearlayout.removeView(currentView);
list2.setVisibility(View.VISIBLE);
String[] names1 = new String[] { "LOCATION ", "llll",
"Eclipse", "Suse",
"cccccccccc", "cccccccccccc", "cccccccccccc",
"iPhone"};
list2.setAdapter(new
ArrayAdapter<String>(SearchClass.this, android.R.layout.simple_list_item_1,
namesLOCATIOn));
linearlayout.addView(previousView);
return false;
}
});
But after executing it is showing list with names1 content on touch of both
edittexts.
How to resolve this problem..Please reply
--
Regards,
Vani Reddy
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en