想從oncreate中調用函數,應用就終止。需要實現的是修改TextView中的文本。請幫忙謝謝。
public class BellSchedules extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_bell_schedules);
BellSch(null);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.bell_schedules, menu);
return true;
}
public void BellSch(View view)
{
TextView bells = (TextView) findViewById(R.id.textView1);
int date = (Calendar.DAY_OF_WEEK);
String realDate = getString(date);
//bells.setText(realDate);
bells.setText("huehuehuehuehue");
}
String realDate = getString(date);
這句有錯,getString裡面的參數是Id 在R文件中存在的ID