Mgamerz

Untitled

Aug 18th, 2011
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.76 KB | None | 0 0
  1. public class TestDialog extends Dialog {
  2. private ListView menu;
  3. final String[] items = {"Favorite Stops", "Show Bus Lines", "About","Contact"};
  4.     public TestDialog(Context context) {
  5.         super(context);
  6.         requestWindowFeature(Window.FEATURE_NO_TITLE); //Hide the title
  7.         MySimpleArrayAdapter adapter = new MySimpleArrayAdapter(context, items);
  8.         this.setContentView(R.layout.dialog);
  9.         menu=(ListView)findViewById(R.id.ListView01);
  10.         // By using setAdpater method in listview we an add string array in list.
  11.         menu.setAdapter(adapter);
  12.        
  13.         menu.setOnItemClickListener(new OnItemClickListener()
  14.         {
  15.             public void onItemClick(AdapterView<?> arg0, View arg1, int arg2,
  16.                     long arg3) {
  17.                 Log.e("sys","Hello from ListView");
  18.             }
  19.         });
  20.        
  21.        
  22.         }
  23.    
  24. }
Advertisement
Add Comment
Please, Sign In to add comment