zoukankan      html  css  js  c++  java
  • 团队冲刺二(5)

    5.29日

    朴远东:学习ListView(一),理解Adaper适配器。

    package com.example.toas;

    import android.content.Context;
    import android.view.LayoutInflater;
    import android.view.View;
    import android.view.ViewGroup;
    import android.widget.BaseAdapter;
    import android.widget.TextView;

    import java.util.ArrayList;

    public class MyNoteAdapter extends BaseAdapter {
        private Context context;
        private ArrayList<MyNoteBean> listData;

        public MyNoteAdapter(Context context,ArrayList<MyNoteBean> listData){
            this.context=context;
            this.listData=listData;
        }

        @Override
        public int getCount() {  return listData.size(); }

        @Override
        public Object getItem(int position) { return listData.get(position); }

        @Override
        public long getItemId(int position) { return position; }

        @Override
        public View getView(int position, View convertView, ViewGroup parent) {
            ViewHolder viewHolder=null;
            if(convertView==null){
                LayoutInflater inflater=LayoutInflater.from(context);
                //这里将ListView的格式xml文件名称写入,名字千万别写错,否则调用后显示的格式会发生错误
                convertView=inflater.inflate(R.layout.list_item,null);
                viewHolder=new ViewHolder();
                viewHolder.li_title=(TextView)convertView.findViewById(R.id.li_title);
                viewHolder.li_kemu=(TextView)convertView.findViewById(R.id.li_kemu);
                convertView.setTag(viewHolder);
            }
            viewHolder=(ViewHolder)convertView.getTag();
            MyNoteBean model=listData.get(position);
            viewHolder.li_title.setText(model.getTitle());
            viewHolder.li_kemu.setText(model.getKemu());
            return convertView;
        }
    }
    class ViewHolder{
        public TextView li_title;
        public TextView li_kemu;
    }

    ——————

    张宏伟:研究app应用跳转,发现新大陆

    final String qqUrl = "mqqwpa://im/chat?chat_type=wpa&uin=100000&version=1";findViewById(R.id.ll_online_qq).setOnClickListener(new View.OnClickListener() {    @Override    public void onClick(View v) {        startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(qqUrl)));    }});
    可直接跳转至QQ。

    王兵兵:完善记笔记的信息录入,整合朴远东更改后的图片路径管理,更改数据库格式

    private boolean testFile(HttpServletRequest request)
    {
    boolean flag=false;
    Note note=new Note();
    Map<String, String> fileMap=new HashMap<String, String>();
    String title=request.getParameter("title");
    String see=request.getParameter("see");
    String kemu=request.getParameter("kemu");
    String userID=request.getParameter("userID");
    int userId=Integer.valueOf(userID);
    System.out.println("标题:"+title);
    System.out.println("是否公开:"+see);
    System.out.println("科目:"+kemu);
    System.out.println("用户ID:"+userId);

    note.setTitle(title);
    note.setCourse(kemu);
    note.setPermission(see);

    DiskFileItemFactory factory=new DiskFileItemFactory();
    ServletFileUpload sfu=new ServletFileUpload(factory);
    sfu.setFileSizeMax(30*1024*1024);
    List<FileItem> list=null;
    String path="G:/CloudNoteTry/";
    String path1="";
    Date t = new Date();
    SimpleDateFormat df = new SimpleDateFormat("yyyyMMdd");
    SimpleDateFormat df2 = new SimpleDateFormat("yyyy-MM-dd");
    String date=df.format(t);
    String date_sql=df2.format(t);
    note.setDate(date_sql);
    int a=1;
    try {
    list = sfu.parseRequest(request);
    } catch (FileUploadException e1) {
    // TODO Auto-generated catch block
    e1.printStackTrace();
    return false;
    }
    for(FileItem fileItem:list)
    {
    if(fileItem.isFormField())
    {

    String filename=fileItem.getFieldName();
    String value=null;
    try {
    value = fileItem.getString("utf-8");
    } catch (UnsupportedEncodingException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
    return false;
    }
    if(filename.equals("username")) 
    {
    path=path+value;
    path1=path1+value;
    File file=new File(path);
    if(!file.exists()) 
    {
    file.mkdir();
    }
    path=path+"/"+date;
    path1=path1+"/"+date;
    File file2=new File(path);
    if(!file2.exists()) 
    {
    file2.mkdir();
    }
    }

    System.out.println(filename+"="+value);
    }
    else 
    {
    long size = fileItem.getSize();
    //判断size是否为0
    if(size==0){
    continue;
    }
    //获取文件的类型
    String contentType = fileItem.getContentType();
    //获取文件的名字
    String name = fileItem.getName();

    String prefix = UUID.randomUUID().toString().replace("-", "");
    name = prefix+"_"+name;
    if(contentType.equals("text/plain"))
    {
    fileMap.put("txt_path",path1+"/"+name);
    }
    else 
    {
    fileMap.put("image"+a+"_path",path1+"/"+name);
    a++;
    }
    //获取表单项的属性名
    String fieldName = fileItem.getFieldName();
    System.out.println("文件的大小: "+size);
    System.out.println("文件的类型: "+contentType);
    System.out.println("文件的名字: "+name);
    System.out.println("表单项name属性名: "+fieldName);
    //将文件写入到磁盘中
    try {
    fileItem.write(new File(path+"/"+name));
    } catch (Exception e) {
    // TODO Auto-generated catch block
    e.printStackTrace();

    }
    }
    }
    note.setFileMap(fileMap);
    try {
    userService=UserService.getUserService();
    } catch (Exception e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
    flag=false;
    }
    flag=userService.addNote(note,userId);
    return flag;
    }等

  • 相关阅读:
    win7,win8,win8.1修复IE浏览器的建议
    推荐给.net程序员的学习网站
    OLTP与OLAP
    profiler列名的具体意义
    sp_reset_connection
    IDENTITY
    【读书笔记】Android Handler和Looper流程
    Android视频/音频缓存框架AndroidVideoCache
    Android KeyStore格式转换工具
    使用Android Studio开发NDK
  • 原文地址:https://www.cnblogs.com/pyd2020/p/13027409.html
Copyright © 2011-2022 走看看