繁体   English   中英

如何通过API WebService在ActionBar SearchView Android上按名称搜索?

[英]How to search by name on actionbar searchview android from api webservice?

我的Android应用程序不直接从API WebService使用sqlite数据库。现在我想在API WebService示例的ActionBar SearchView上通过用户名搜索webservice mydomain.com/api/search/action=search&q=我已经有了ui,但是我该怎么办it.please帮我示例代码。 我怎样才能从API测试条件搜索和q。

All you need to do is follows 
1. invoke the service call in search button click 
 For this there are many ways, start with the easiest one, one of them is as follows
http://www.vogella.com/tutorials/ApacheHttpClient/article.html

2. Populate the result in list. 
Once you have got the response in form of json or string, you need to format data in form of string array and do as follows
mListView = (ListView) findViewById(R.id.list_view);
        mListView.setAdapter(mAdapter = new ArrayAdapter<String>(this,
                android.R.layout.simple_list_item_1,
                mStringArray));

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM