我在使用 OnItemClickListener 的通知代码中有 3 个错误我需要应用,当单击一个项目时它显示通知这里是代码:
list.setOnItemClickListener(new OnItemClickListener(){
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
// TODO Auto-generated method stub
Bundle programNum = getIntent().getExtras();
final String progNum = programNum.getString("ProgNum");
final String dayNum = programNum.getString("DayNum");
final List<TouringPrograms> startTime = datasource.getTouringProgramsStartTime(progNum, dayNum);
final List<TouringPrograms> endTime = datasource.getTouringProgramsEndTime(progNum, dayNum);
Intent intent = new Intent(this, ProgramsList2.class);
PendingIntent pi = PendingIntent.getActivity(this, 0, intent, 0);
String body = (String) ((TextView)parent.getChildAt(position)).getText();
String title = "Egypt On The Go";
String time = body + "\n start at:" + startTime.get(position)+ "\n end at:" + endTime.get(position);
Notification n = new Notification(R.drawable.egypt, time, System.currentTimeMillis());
n.setLatestEventInfo(this, title, time, pi);
n.defaults = Notification.DEFAULT_ALL;
nm.notify(uniqueID, n);
//String time1 = "" + System.currentTimeMillis();
//Toast.makeText(this, time1, Toast.LENGTH_SHORT).show();
//finish();
}});
3错误:
1.Intent 意图 = new Intent(this, ProgramsList2.class);
2.PendingIntent pi = PendingIntent.getActivity(this, 0, intent, 0);
3.n.setLatestEventInfo(this, title, time, pi);
请问有什么帮助吗?