and if it helps, this is how I populate my ListView:
public View getView(int arg0, View arg1, ViewGroup arg2) {
View layout = View.inflate(context, R.layout.program,
null);
(load views and set their values ...)
Button btDelete = (Button)
layout.findViewById(R.id.btDelete);
btDelete.setOnClickListener(new OnClickListener(){
@Override
public void onClick(View v) {
(on click action for a button inside the
view that
builds each item in the list)
}
});
return layout;
}
On 7 set, 18:55, Gabriel Simões <[email protected]> wrote:
> Guys,
>
> Tried changing to an AlertBuilder but got the same result:
>
> Builder loadDialog = new AlertDialog.Builder(this);
> loadDialog.setIcon(R.drawable.load);
> loadDialog.setTitle("Program Loading Center");
> loadDialog.setMessage("");
> View v = View.inflate(this, R.layout.load, null);
> final ListView lvList = (ListView)
> v.findViewById(R.id.lvList);
> lvList.setOnItemClickListener(new OnItemClickListener(){
> @Override
> public void onItemClick(AdapterView<?> arg0, View
> arg1, int arg2,
> long arg3) {
> removeDialog(DIALOG_LOAD_ID);
> FlurryAgent.onEvent("Load", null);
> }
> });
> lvList.setAdapter(new DBAdapter(this));
> loadDialog.setView(v);
>
> Everything is displayed just as expected but when I the function
> onItemClick is never fired (clicking on any of the items displayed at
> lvList, which inflated from the same layout containing textviews and a
> button, all over a relativelayout).
>
> Any other ideas?
>
> tnx
>
> On 7 set, 18:04, Gabriel Simões <[email protected]> wrote:
>
>
>
> > what intrigates me is that the listeners for the buttons work
> > perfectly, plug & play.
> > :/
>
> > On 7 set, 17:54, Mark Murphy <[email protected]> wrote:
>
> > > 2010/9/7 Gabriel Simões <[email protected]>:
>
> > > > If I´m not wrong I can´t inflate a layout on an alertdialog, right?
>
> > > Sure you can.
>
> > > > On this Layout I have more than a ListView (buttons and TextViews) so
> > > > to use an AlertDialog probably is not the best solution for me right
> > > > now.
>
> > > That probably should not be a dialog. Use an activity.
>
> > > > About the context, I didn´t get it. I thought that when I created a
> > > > dialog I should pass to it the context of the activity that created
> > > > it, am I wrong?
>
> > > The Activity *is* a Context. Never call getApplicationContext().
>
> > > > If I don´t decide to use an alertdialog, is there a way to make it
> > > > work using a "pure" dialog?
>
> > > Use an activity. Give it Theme.Dialog if you want it to look like a
> > > dialog.
>
> > > --
> > > Mark Murphy (a Commons
> > > Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy
>
> > > Android Training in London:http://skillsmatter.com/go/os-mobile-server
--
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