0

I am trying to create a fast Scroll with Alphabetical letters. Can somebody tell me how can I use the code in this question in another class? I have a class with a method that returns letters I need to put in the fast scroll, so I want to use this class in another one, like this:

MyListAdaptor mla = new MyListAdaptor(getApplicationContext(), itemsBP);
mla.xyz();

but then I don't know how I can make the letters appear.

If you can, help me please.

Community
  • 1
  • 1
Soraia
  • 3
  • 3
  • I'm giving him a parameter list that I want (itemsBP), there's something missing for the operation? I have no adpter ... actually my difficulty is understanding the steps needed to create this FastScroll. if you can, please helpe me. Thank you, Soraia Oliveira – Soraia Sep 18 '12 at 10:39
  • So you copy his adapter to test FastScroll? – Trung Nguyen Sep 18 '12 at 10:59
  • i think yes... can you tell me what I need to do to put this code to work on my? i really appreciate your help, thank you – Soraia Sep 18 '12 at 11:07

1 Answers1

0

At the end of some research I realized that what was missing was the following code, which must be placed in OnCreate ():

LinkedList <String> mLinked <String> = new LinkedList ();
for (int i = 0; i <nomes.length: i + +) {
mLinked.add (names [i]);
}

setListAdapter (new MyListAdaptor (this, mLinked));

ListView lv = getListView ();
lv.setFastScrollEnabled (true);

lv.setOnItemClickListener (new OnItemClickListener () {
public void onItemClick (AdapterView <?> parent, View view,
int position, long id) {
/ / When clicked, show a toast with the TextView text


Toast.makeText (getApplicationContext (), ((TextView) view). GetText (). ToString (), Toast.LENGTH_SHORT.) Show ();
}
});

And put the class code within the class MyListAdaptor Main OnCreate ().

Thanks for the help and hopefully this can help others in the future.

Community
  • 1
  • 1
Soraia
  • 3
  • 3