안드로이드 개발 질문/답변
(글 수 45,052)
달력을 실행할 액티비티입니다.
Intent intent = new Intent(net.this, Tab1.class); startActivity(intent);
인텐트를 통해서 액티비티를 실행하려는데요...
혹시나해서 간단하게 반든 다른 액티비티로 인텐트했을때는 잘 실행이 되는데,
이 액티비티에서는 유독 멈추네요...ㅜㅜ
무슨 문제일까요?
내일까지는 해결해야해서 마음이 좀 급하네요..ㅜㅜ
부탁드리겠습니다^^
package my.net;
import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.AdapterView;
import android.widget.Button;
import android.widget.TextView;
public class Tab1 extends Activity {
CalendarMonthView monthView;
CalendarMonthAdapter monthViewAdapter;
TextView monthText;
int curYear;
int curMonth;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main2);
monthView = (CalendarMonthView) findViewById(R.id.monthView);
monthViewAdapter = new CalendarMonthAdapter(this);
monthView.setAdapter(monthViewAdapter);
// set listener
monthView.setOnDataSelectionListener(new OnDataSelectionListener() {
@SuppressWarnings("unchecked")
public void onDataSelected(AdapterView parent, View v, int position, long id) {
MonthItem curItem = (MonthItem) monthViewAdapter.getItem(position);
int day = curItem.getDay();
//Toast.makeText(getApplicationContext(), "Selected : " + day, 1000).show();
Log.d("CalendarMonthViewActivity", "Selected : " + day);
}
});
monthText = (TextView) findViewById(R.id.monthText);
setMonthText();
Button monthPrevious = (Button) findViewById(R.id.monthPrevious);
monthPrevious.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
monthViewAdapter.setPreviousMonth();
monthViewAdapter.notifyDataSetChanged();
setMonthText();
}
});
Button monthNext = (Button) findViewById(R.id.monthNext);
monthNext.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
monthViewAdapter.setNextMonth();
monthViewAdapter.notifyDataSetChanged();
setMonthText();
}
});
}
private void setMonthText() {
curYear = monthViewAdapter.getCurYear();
curMonth = monthViewAdapter.getCurMonth();
monthText.setText(curYear + "년 " + (curMonth+1) + "월");
}
}


