Advertisement
Guest User

Untitled

a guest
Oct 30th, 2014
142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.41 KB | None | 0 0
  1. public static final String[] maintitle = new String[] { "Rajnikant",
  2. "Kamla Hasan", "Mahesh Babu","Chiranjivi","Surya","Rajkumar","Shivraj Kumar"};
  3.  
  4. public static final Integer[] mainimages = { R.drawable.ic_launcher,R.drawable.ic_launcher,R.drawable.ic_launcher,R.drawable.ic_launcher,R.drawable.ic_launcher,R.drawable.ic_launcher,R.drawable.ic_launcher};
  5. public static final Integer[] mainimagearow = {R.drawable.arrow,R.drawable.arrow,R.drawable.arrow,R.drawable.arrow,R.drawable.arrow,R.drawable.arrow,R.drawable.arrow };
  6.  
  7.  
  8. ListView listView;
  9. List<ActorsItems> actoritem;
  10.  
  11. private EditText inputserach;
  12.  
  13.  
  14. ActorsListAdapter adapter;
  15.  
  16. private AutoCompleteTextView inputSearch;
  17.  
  18.  
  19. @Override
  20. protected void onCreate(Bundle savedInstanceState) {
  21. // TODO Auto-generated method stub
  22. super.onCreate(savedInstanceState);
  23. setContentView(R.layout.list_view_mainmenu);
  24.  
  25.  
  26. inputserach=(EditText)findViewById(R.id.autoCompleteTextView1);
  27. actoritem = new ArrayList<ActorsItems>();
  28. for (int i = 0; i < maintitle.length; i++) {
  29. ActorsItems item = new ActorsItems(mainimages[i],maintitle[i],mainimagearow[i]);
  30. actoritem.add(item);
  31. }
  32.  
  33. listView = (ListView) findViewById(R.id.list_main_menu);
  34. adapter= new ActorsListAdapter(this, actoritem);
  35. listView.setAdapter(adapter);
  36. listView.setOnItemClickListener(this);
  37.  
  38. inputSearch = (AutoCompleteTextView) findViewById(R.id.autoCompleteTextView1);
  39. inputserach.addTextChangedListener(new TextWatcher() {
  40.  
  41. @Override
  42. public void onTextChanged(CharSequence s, int start, int before, int count) {
  43. // TODO Auto-generated method stub
  44.  
  45.  
  46. adapter=new ActorsListAdapter(getApplicationContext(), actoritem);
  47.  
  48.  
  49. listView.setAdapter(adapter);
  50.  
  51.  
  52. }
  53.  
  54. @Override
  55. public void beforeTextChanged(CharSequence s, int start, int count,
  56. int after) {
  57. // TODO Auto-generated method stub
  58.  
  59. }
  60.  
  61. @Override
  62. public void afterTextChanged(Editable s) {
  63. // TODO Auto-generated method stub
  64.  
  65. }
  66. });
  67. }
  68.  
  69. @Override
  70. public void onItemClick(AdapterView<?> parent, View view, int position,
  71. long id) {
  72. Toast toast = Toast.makeText(getApplicationContext(),
  73. "Item " + (position + 1) + ": " + actoritem.get(position),
  74. Toast.LENGTH_SHORT);
  75. toast.setGravity(Gravity.BOTTOM|Gravity.CENTER_HORIZONTAL, 0, 0);
  76. toast.show();
  77.  
  78.  
  79. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement