zoukankan      html  css  js  c++  java
  • 软工每日总结6

    今天的工作是将百度地图的建议结果查询集成到我们的软件中:

    主要代码:

    mSuggestionSearch = SuggestionSearch.newInstance();
    mSuggestionSearch.setOnGetSuggestionResultListener(this);
    addTextChangedListener(new TextWatcher() {

    @Override
    public void afterTextChanged(Editable arg0) {
    Log.e("e","after");
    }

    @Override
    public void beforeTextChanged(CharSequence arg0, int arg1,
    int arg2, int arg3) {
    Log.e("e","before");
    }

    @Override
    public void onTextChanged(CharSequence cs, int arg1, int arg2,
    int arg3) {
    Log.e("e","on");
    if (cs.length() <= 0) {
    return;
    }
    String city = "北京";
    /**
    * 使用建议搜索服务获取建议列表,结果在onSuggestionResult()中更新
    */
    mSuggestionSearch
    .requestSuggestion((new SuggestionSearchOption())
    .keyword(cs.toString()).city(city));
    }
    });

    @Override
    public void onGetSuggestionResult(SuggestionResult res) {
    if (res == null || res.getAllSuggestions() == null) {
    Log.e("e", "invalid");
    return;
    }
    str=new String[10];
    int i=0;
    for (SuggestionResult.SuggestionInfo info : res.getAllSuggestions()) {
    if (info.key != null&&i<10) {
    str[i] = info.key;
    Log.e("e",info.key);
    i++;
    }
    }
    sugAdapterSt = new ArrayAdapter<String>(this,
    android.R.layout.simple_dropdown_item_1line,str);
    editSt.setAdapter(sugAdapterSt);
    sugAdapterEd = new ArrayAdapter<String>(this,
    android.R.layout.simple_dropdown_item_1line,str);
    editEn.setAdapter(sugAdapterEd);
    }
    遇到的问题:android studio导入eclipse的安卓工程时出现开发环境不兼容的情况,一些图片资源无法正常使用,在降低AS使用的gradle版本之后得到暂时解决,还有就是windows下的开发工具大多不使用utf-8编码,导致导入到linux环境后中文乱码。
  • 相关阅读:
    awk实例
    imagemagick imagick
    sort 命令
    cut 命令
    tr命令
    uniq
    多线程编程之Linux环境下的多线程(一)
    多线程编程之Windows同步方式
    多线程编程之数据访问互斥
    多线程编程之基础概念
  • 原文地址:https://www.cnblogs.com/evi10032/p/5645795.html
Copyright © 2011-2022 走看看