one more question, why mFootView.setOnClickListener  not working? am i doing
sth wrong?

On Thu, May 6, 2010 at 2:13 PM, Second Dancer <[email protected]>wrote:

> That is the right way and still the smart way, unless you don't use
> listview
>
> On May 6, 2010 3:58 AM, "Vincent Tsao" <[email protected]> wrote:
>
> i have add a footview in listview with this code:
>   mListView.addFooterView(mFootView);
>
> and also Register a callback to be invoked when this mFootView is clicked
> with code below:
>
> mFootView.setOnClickListener(new OnClickListener() {
>             @Override
>             public void onClick(View v) {
>               // my code
>             }
>  });
>
> after this, when i press down dpad, there is no response, so i Register a
> callback to be invoked when a key is pressed in this mFootView. with code
> below:
>
>           mHiddenFolders.setOnKeyListener(new OnKeyListener(){
>
>             @Override
>             public boolean onKey(View v, int keyCode, KeyEvent event) {
>                 // my code
>                Log.v("onKey", "test");
>                 return  true;
>             }
>
>         });
>
> unfortunately, still nothing happened :(
>
> After some attempt, i found this ugly way:
>
> @Override
>     public void onItemClick(AdapterView<?> parent, View view, int position,
>             long id) {
>         // TODO Auto-generated method stub
>
>         if (id == -1) {
>             if (position == 0) {
>                * // when click a header view*
>             } else {
>                *// when click a footer view*
>             }
>         } else {
>            * // when click other normal row*
>         }
>     }
>
> finally, it works, but i'm wondering if there is a smart way to do this?
>
>
>  --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]<android-developers%[email protected]>
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
>
>  --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]<android-developers%[email protected]>
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to