I want to display current date and time using calendar.my code is
LinearLayout lview=new LinearLayout(this);
myText=new TextView(this);
strText=new TextView(this);
Calendar c=Calendar.getInstance();
int seconds=c.get(Calendar.SECOND);
myText.setText("Your current seconds are:");
strText.setText(seconds);
lview.addView(strText);
lview.addView(myText);
setContentView(lview);
but it shows the app unfortunately stops working without displaying date..
Setting Layout Paramaters for each view will solve your problem