开发者

Listview Display issue

I am pretty new to android. I am trying to create a test app that will show the call log name and number. User can select it to see more details. I have ListActivity class to show Call the Call Log. This is called from the main activity (main activity has buttons and is housed inside a Tab activity). I am using the standard single line layout from android to display the number. List is displayed fine, but when I scroll, alternate items are selected. After some scrolling, the caching is really bad (each number stacked on top of another).

The code as such works fine if I use in a different project - listview is shown and scrolling etc works fine. I am not able to figure out what specifically in my original app is causing the issue. When I call the android contacts Intent, it works fine. My code to call the list is

public class callLog extends ListActivity {
private ListView list;
private ArrayList<String> cLNumber = new ArrayList<String>(); 
private HashSet<String> remDupl = new HashSet<String>();

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.logview);
    list = getListView();


    cLNumber.add("Test 1");
    cLNumber.add("Test 2");
    cLNumber.add("Test 3");
    cLNumber.add("Test 4");
 开发者_StackOverflow中文版   cLNumber.add("Test 5");
    cLNumber.add("Test 6");
    cLNumber.add("Test 7");
    cLNumber.add("Test 8");
    cLNumber.add("Test 9");
    cLNumber.add("Test 10");
    cLNumber.add("Test 11");
    cLNumber.add("Test 12");
    cLNumber.add("Test 13");
    cLNumber.add("Test 14");
    cLNumber.add("Test 15");
    cLNumber.add("Test 16");
    cLNumber.add("Test 17");

  //Remove Duplicates
    remDupl.addAll(cLNumber);
    cLNumber.clear();
    cLNumber.addAll(remDupl);

    ArrayAdapter<String> cLogList = new ArrayAdapter<String>    (this.getBaseContext(),android.R.layout.simple_list_item_1, cLNumber);
     list.setChoiceMode(ListView.CHOICE_MODE_NONE);  
     list.setAdapter(cLogList);
}}

See the screenshot here

I tried different options and I am starting to look at TableLayout a backup option. Did any one faced a similar issue? [The screen shot is from android 1.5 emulator, but its happening on 2.1 as well as on devices]

Thanks in advance

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜