Display event if the button is clicked
[unical.git] / src / ro / ieval / unical / EventListActivity.java
CommitLineData
0b5b93a4
PT
1package ro.ieval.unical;
2
3import java.util.Arrays;
0b5b93a4 4import java.util.Date;
0c5f3a9b 5import java.util.GregorianCalendar;
0b5b93a4 6
0b5b93a4 7import android.app.Activity;
0c5f3a9b
PT
8import android.content.Intent;
9import android.graphics.Color;
0b5b93a4 10import android.os.Bundle;
0c5f3a9b
PT
11import android.view.View;
12import android.view.View.OnClickListener;
0b5b93a4
PT
13import android.widget.Button;
14import android.widget.LinearLayout;
15
16
17public class EventListActivity extends Activity {
18 GregorianCalendar gc;
19
20 @Override
21 protected void onCreate(Bundle savedInstanceState) {
22 // TODO Auto-generated method stub
23 super.onCreate(savedInstanceState);
24 setContentView(R.layout.event_list);
25
26 Date d=new Date();
27 d.getTime();
28 gc=new GregorianCalendar();
29 gc.setTime(d);
30
31 Event r[]=Event.getAllEvents(getBaseContext());
32 LinearLayout ll = (LinearLayout)findViewById(R.id.eventslayout);
0b5b93a4 33 Arrays.sort(r,new EventComparator());
0c5f3a9b
PT
34 EventButton[] b=new EventButton[10000];
35 for(int i=0; i<r.length; ++i) {
36 b[i]=new EventButton(getBaseContext(),r[i]);
37 b[i].setText(r[i].title);
38
39 b[i].setTextColor(Color.BLACK);
40 b[i].setOnClickListener(new OnClickListener() {
41
42 @Override
43 public void onClick(View v) {
44 // TODO Auto-generated method stub
45 EventButton b=(EventButton) v;
46 DisplayEventActivity.displayEvent(EventListActivity.this,b.e);
47 //Intent i=new Intent(getBaseContext(),DisplayEventActivity.class);
48 //i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
49 //startActivity(i);
50 }
51 });
52 ll.addView(b[i]);
0b5b93a4
PT
53 }
54 }
0c5f3a9b 55
0b5b93a4 56}
This page took 0.012386 seconds and 4 git commands to generate.