习题源代码第11章信息发送扩展功能_第1页
习题源代码第11章信息发送扩展功能_第2页
习题源代码第11章信息发送扩展功能_第3页
习题源代码第11章信息发送扩展功能_第4页
习题源代码第11章信息发送扩展功能_第5页
已阅读5页,还剩11页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、本章主要详细介绍了老师向学生发信息即老师给选了该门课的学生信息那么(该老师当然是教授该门课程的老师程序将如何实现?这是第十一章扩展功能的代码这是第十一章扩展功能的代码android:padding="0dip"> 通知">privateButtonbutton_notice_teacher;//button_notice_teacher=(Button)privateButtonbutton_notice_teacher;//button_notice_teacher=(Button)button_notice_teacherbutton_notice_teacher.setOnClickListener(newOnClickListener(){publicvoidonClick(Viewv)Intentintent=newIntent(StudentMainActivity.this,Bundlebundle=newBundle();bundle.putInt("studentid",studentid);}packagepublicclassTabMessageActivitymypackagepublicclassTabMessageActivitymyextendsTabActivitypublicContextprivateAsyncHttpSharedPreferencespreferences;SharedPreferences.Editoreditor; privateTabHostprivateListViewCourseprivateString[]student_Information=newprivateList<String>courseNames=newprivateList<Integer>courseid_temp=newprivateintprivatefinalstaticintprivatefinalstaticintpublicvoidonCreate(BundlesavedInstanceState)新建一 设置 tabhost.setOnTabChangedListener(newOnTabChangeListener()publicvoidonTabChanged(StringtabId){}}}void{}publicvoidload()=new RequestParamsparams=newRequestParams();params.put("studentid",studentid+"");params.put("action","student_course_teacher");///.post(HttpUtil.server_student_course_teacher,newJsonHttpResponseHandler(){publicvoidonSuccess(intarg0,JSONObjectarg1){List<Course>courseList=JSONObjectobject=Coursecourse=newCourse(); }student_Information=course=newfor(int{course[i]=newCourse();}super.onSuccess(arg0,}}//void { {listView=(ListView)for(inti=0;i<course.length;i++){ }listView.setAdapter(newArrayAdapter<String>(this,newAdapterView.OnItemClickListener(){publicvoidonItemClick(AdapterView<?>arg0,Viewarg1,intarg2,longarg3){}}}voidservicer(Course{RequestParamsparams=newRequestParams();params.put("studentid",studentid+"");params.put("action","class_phone_number");params.put("courseid",courses.getCId()+"");System.out.println(courses.getCId());Intentintent=newIntent(TabMessageActivitymy.this,Bundlebundle=newBundle();bundle.putInt("studentid",studentid); bundle.putInt("courseid",courses.getCId());}privatevoid {}void{this.context==new preferences=getSharedPreferences("courseMis",0);editor=preferences.edit();studentid=preferences.getInt("studentid",}}程序:05/5.6/ <actionname="student_course_teacher"<actionname="student_course_teacher"publicvoidpublicvoidgetCourseOfStudent()throwsIOException{intstudentid=List<Studentcourse>studentcourseList=JSONObjectresp=newJSONObject();JSONArrayjsonArray=newJSONArray();for(inti=0;i<studentcourseList.size();i++){JSONObjectobject_temp=newJSONObject();intcourseid_temp=Coursecourse_temp=courseService.getCourseById(courseid_temp);List<Coursetime>coursetime_temp=object_temp.element("CId",course_temp.getCId()); jsonArray.add(i,object_temp); }resp.put("result",PrintWriterout=response.getWriter();}packagepublicclassMessageInfoActivitymypackagepublicclassMessageInfoActivitymyextendsActivitypublicContextcontext;//privateAsyncHttpprivateTextViewet_phone;privateTextViewmsg_table;privateEditTextet_content;privateButtonbt_send;StringCName=newVector<String>numbers=newprivateintstudentid;privateintteacherid;privateintcourseid;Stringall_msg=newString();//用于存放从数据库 publicvoidonCreate(BundlesavedInstanceState){this.context==new et_phone=(TextView)findViewById(R.id.msg_phone);msg_table=(TextView)findViewById(R.id.msg_table);et_content=(EditText)findViewById(R.id.msg_content);bt_send=(Button)findViewById(R.id.msg_send);Intentintent=getIntent();Bundlebundle=intent.getExtras();CName=bundle.getString("CName");//获取 courseidintent.getExtras().getInt("courseid"获取课程idstudentid=intent.getExtras().getInt("studentid");/**获取已发过的信息和要发的号码**/RequestParamsparamsnewRequestParams();params.put("studentid",studentid+"");params.put("courseid",courseid+"");params.put("CName",CName);params.put("action",.post(HttpUtil.server_note_get_student,newJsonHttpResponseHandler(){publicvoidonSuccess(intarg0,JSONObjectarg1)for(inti=0;i<.length();i++)JSONObjectobject=Stringcontent_temp=Stringdatetime_temp=all_msg=all_msg+content_temp++datetime_temp+}System.out.println(Stringnumber= super.onSuccess(arg0,}Toast.makeText(context,"loadMessage4",Toast.LENGTH_SHORT).show();bt_send.setOnClickListener(newOnClickListener(){publicvoidonClick(Viewv){Stringcontent=newString(); =newString();content=et_content.getText().toString();Object[]objects=newString[numbers.size()];objects=numbers.toArray();for(inti=0;i<numbers.size();i++)=(String) //if .length()<if(content.length()<1){Toast.makeText(getApplicationContext(),请输入内容",}SmsManagersmsManager=SmsManager.getDefault();PendingIntentsentIntent=PendingIntent.getBroadcast(MessageInfoActivitymy.this,0,newIntent(),if(content.length()>=70) List<String>ms=for(Stringstr:ms) ,null,str,sentIntent,null);}}else ,null,content,sentIntent,null);}}Toast.makeText(context,"addMessage",//addMessage(content);/** Toast.makeText(contextbegin...addMessage",RequestParamsparams=newRequestParams();params.put("studentid",studentid+"");params.put("name_course",CName);params.put("content_message",content+.post(HttpUtil.server_note_add_student,newJsonHttpResponseHandler(){publicvoidonSuccess(intarg0,JSONObject{

StringaddMessage_msg=super.onSuccess(arg0,}publicvoidonFailure(Throwablearg0,JSONObjectarg1){Toast.makeText(context,"onFailure...",super.onFailure(arg0,}RequestParamsparams1=newRequestParams();params1.put("studentid",studentid+"");params1.put("courseid",courseid+"");params1.put("CName",CName);params1.put("action","server_message_get");.post(HttpUtil.server_note_get_student,newJsonHttpResponseHandler(){publicvoidonSuccess(intarg0,JSONObject{for(inti=0;i

.length();i++)JSONObjectobject=arg1.optJSONArray(Stringcontent_temp=Stringdatetime_temp=objectall_msg=all_msg+content_temp++datetime_temp+////}super.onSuccess(arg0,}}}}程序:05/5.6/publicpublicstaticStringserver_note_add=server+=+<actionname="note_get_student"<actionname="note_get_student"class="com.coursemis.action.NoteAction"method="getNoteOfStudent"><actionname="note_add_student"class="com.coursemis.action.NoteAction"method="studentAddNote">publicvoidpublicvoidgetNoteOfStudent()throwsIOException{intstudentidintcourseidInteger.parseInt(request.getParameter("courseid"));StringCName=request.getParameter("CName");//获得课JSONObjectresp=newintteacherid=Stringnumber=teacherService.getTeacherById(teacherid).getT JSONObjectobject_temp1=newJSONObject(); resp.put("result2",object_temp1);List<Note2>notes=System.out.println("note2s'num="+JSONArrayjsonArray=newfor(intJSONObjectobject_temp=newJSONObject();object_temp.element("NId",notes.get(i).getNId());S

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论