Hi to everyone,
I have the following problem..
I have a ListView, and I want this: when a ListItem is selected, a
PopupWindow appears with a button inside. Then I want to be able to
set the button click action.
This is my function:
protected void onListItemClick(ListView l, View v, int position, long
id) {
super.onListItemClick(l, v, position, id);
PopupWindow pw = new
PopupWindow(this.getLayoutInflater().inflate(R.layout.scelta,
null, true),100,100,true);
ColorDrawable dw=new ColorDrawable(-65281);
pw.setBackgroundDrawable(dw);
pw.showAsDropDown(l);
Button delete= (Button) findViewById(R.id.delete);
delete.setOnClickListener(new Button.OnClickListener(){
public void onClick(View v){
delete();
}
});
The following is scelta.xml:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/
android"
android:orientation="vertical" android:layout_width="fill_parent"
android:layout_height="fill_parent">
<Button android:id="@+id/edit"
android:text="@string/edit"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<Button android:id="@+id/cancella"
android:text="@string/cancella"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
The problem is that this code doesn't works, and when I try to debug
it, it seems that it's not possible to find the button. (the button
value is null).
Any suggestion?
Thanks
Gabri
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---