当前位置:  编程技术>移动开发
本页文章导读:
    ▪listView取得CheckBox 的位置        listView获得CheckBox 的位置 当一个lsitView中每个ietm有多个控件的时候想获得其中的位置,其实主要是item的位置 @Override public View getView(int position, View convertView, ViewGroup parent) {  // grab view View v =.........
    ▪ how to use data extraction API for java applications        how to use data extraction API for java applications? you can absolutely use Java to access the data.  Many people already have in creating Java apps, web apps, Android Java apps, and Blackberry Java ME apps. We created our Data Extraction API in.........
    ▪ 动态增添list item       动态添加list item 由于扫描比较多的文件,考虑在扫描的到部分文件的时候就予以显示,也就是说需要动态来添加items。  首先开启线程来进行扫描,一旦获得匹配则发送message来进行数据.........

[1]listView取得CheckBox 的位置
    来源: 互联网  发布时间: 2014-02-18
listView获得CheckBox 的位置

当一个lsitView中每个ietm有多个控件的时候想获得其中的位置,其实主要是item的位置

@Override 
public View getView(int position, View convertView, ViewGroup parent) { 
 
// grab view 
View v = convertView; 
// set view layout 
if (v == null) { 
    LayoutInflater vi = (LayoutInflater)getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE); 
    v = vi.inflate(R.layout.layout_inbox_item, null); 
 
    CheckBox box = (CheckBox)v.findViewById(R.id.inbox_itemcheck); 
    if (box != null) { 
        box.setTag(position); //<-- sets the tag by its position 
        box.setOnCheckedChangeListener(new CheckBox.OnCheckedChangeListener() { 
                public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { 
                    int position = (Integer)buttonView.getTag(); //<-- get the position 
                } 
            }); 
    } 

2.

View getView(int position, View convertView, ViewGroup parent) { 
 
    // grab view 
    View v = convertView; 
    // set view layout 
    if (v == null) { 
        LayoutInflater vi = (LayoutInflater)getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE); 
        v = vi.inflate(R.layout.layout_inbox_item, null); 
 
        CheckBox box = (CheckBox)v.findViewById(R.id.inbox_itemcheck); 
        if (box != null) { 
            box.setOnCheckedChangeListener(new CheckBox.OnCheckedChangeListener() { 
                    public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { 
                        ViewGroup v = (ViewGroup)buttonView.getParent().getParent(); 
                        int i = v.indexOfChild((View)buttonView.getParent()); 
                    } 
                }); 
        } 
    } 

 


    
[2] how to use data extraction API for java applications
    来源: 互联网  发布时间: 2014-02-18
how to use data extraction API for java applications?
you can absolutely use Java to access the data.  Many people already have in creating Java apps, web apps, Android Java apps, and Blackberry Java ME apps.

We created our Data Extraction API in such a way that it is _code free_!  You don't need any code to get data using our REST requests.  In fact, try it out and log in and create a REST url from our http://generator.webtrends.com and then paste the REST URL into your browser address bar and the data will simply return (after you authenticate of course).

But I can give you some helpful pointers for getting your Java app running with our data embedded in it.

The process is simple.

Short summary:

All you need is a java library for making an https connection.
Pass your webtrends account name along with your username in the authentication process with a backslash seperator.
Create your REST request in generator.webtrends.com and choose a format you prefer.
Add a parser library to your java code for the format you chose.

Step by step pointers:

1) For libraries, to make an Extraction request, all you need is any method of making an https request (there are lots of http helper libraries out there) with authentication.  In order to make this as easy to embed in applications as possible, we use http authentication.  Here is a link to apache commons libraries:  http://commons.apache.org/

2) when you pass your username and password in the https request you need to follow this format:

     Username should look like:    webtrendsAccountName\userName     (i.e. the username should have your webt account, backslash, username)

     Password should look like:   password    (send your password as normal of course)

3) practice with a simple Webtrends REST request first.  Create one in generator (http://generator.webtrends.com) from a basic report for "this month" and copy and paste the URL it generates for you into your test code.

4) once you send the https request Webtrends will respond with all the data.  No extra code is needed of any kind.  In fact, if you were to paste that REST request into your browser, the data would simply show in your browser window.

     Do you want it in XML, JSON or HTML format?

     Many developers find it easiest to recieve data in XML because there are so many XML parsers out there.  See my link above to apache commons.

I suggest you use our XML format made friendly for developers and change your rest request to show format=xml2

That "xml2" is not a typo.  We have two xml formats to use and xml2 is the easiest to automate parsing for.

5) get yourself a java parser for the format you chose in step 4.  Apache commons has one for both XML and JSON.  If you want to pursue JSON further (json is more compact, faster and efficient but not as easy to develop for) go to http://json.org/index.html and scroll down and you'll find a dozen or more json parsers for every platform.  If you are using Java to develop for Android, I recommend "gson".

    
[3] 动态增添list item
    来源: 互联网  发布时间: 2014-02-18
动态添加list item
由于扫描比较多的文件,考虑在扫描的到部分文件的时候就予以显示,也就是说需要动态来添加items。
  首先开启线程来进行扫描,一旦获得匹配则发送message来进行数据的刷新(添加)。
在进行adapter的add操作之后,加上语句notifyDataSetChanged();

    
最新技术文章:
▪Android开发之登录验证实例教程
▪Android开发之注册登录方法示例
▪Android获取手机SIM卡运营商信息的方法
▪Android实现将已发送的短信写入短信数据库的...
▪Android发送短信功能代码
▪Android根据电话号码获得联系人头像实例代码
▪Android中GPS定位的用法实例
▪Android实现退出时关闭所有Activity的方法
▪Android实现文件的分割和组装
▪Android录音应用实例教程
▪Android双击返回键退出程序的实现方法
▪Android实现侦听电池状态显示、电量及充电动...
▪Android获取当前已连接的wifi信号强度的方法
▪Android实现动态显示或隐藏密码输入框的内容
▪根据USER-AGENT判断手机类型并跳转到相应的app...
▪Android Touch事件分发过程详解
▪Android中实现为TextView添加多个可点击的文本
▪Android程序设计之AIDL实例详解
▪Android显式启动与隐式启动Activity的区别介绍
▪Android按钮单击事件的四种常用写法总结
▪Android消息处理机制Looper和Handler详解
▪Android实现Back功能代码片段总结
▪Android实用的代码片段 常用代码总结
▪Android实现弹出键盘的方法
▪Android中通过view方式获取当前Activity的屏幕截...
▪Android提高之自定义Menu(TabMenu)实现方法
▪Android提高之多方向抽屉实现方法
▪Android提高之MediaPlayer播放网络音频的实现方法...
▪Android提高之MediaPlayer播放网络视频的实现方法...
▪Android提高之手游转电视游戏的模拟操控
 


站内导航:


特别声明:169IT网站部分信息来自互联网,如果侵犯您的权利,请及时告知,本站将立即删除!

©2012-2021,,E-mail:www_#163.com(请将#改为@)

浙ICP备11055608号-3