[android-developers] Re: how to create a pop up window?

2009-06-05 Thread quanghuytruongdinh

Create a class, for example: IconfiedTextListAdapter extends
BaseAdapter:
@Override
public View getView(int position, View convertView, ViewGroup parent)
{
IconfiedTextView itv;
if(convertView == null){
itv = new IconfiedTextView(mContext, 
mItems.get(position));
} else {
itv = (IconfiedTextView) convertView;
itv.setText(mItems.get(position).getText());
itv.setIcon(mItems.get(position).getIcon());
}
return itv;
}

Explain: IconfiedTextView is a class that extends a Layout, in my
example is:
   public class IconfiedTextView extends LinearLayout

And, in class IconfiedTextView, you can add any view you want to
display in a list's item: ImageView, TextView...
Ex:
public IconfiedTextView(Context context, IconfiedText iText) {
super(context);

this.setOrientation(HORIZONTAL);

mImageView = new ImageView(context);
mImageView.setAdjustViewBounds(true);
mImageView.setMaxWidth(50);
mImageView.setMaxHeight(50);
mImageView.setLayoutParams(new LinearLayout.LayoutParams
(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT));
mImageView.setImageDrawable(iText.getIcon());
mImageView.setPadding(0, 2, 5, 0);
addView(mImageView, new LinearLayout.LayoutParams
(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));

mTextView = new TextView(context);
mTextView.setText(iText.getText());
mTextView.setTextSize((float)14.0);
addView(mTextView, new LinearLayout.LayoutParams
(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT));
}

Now, in your ListActivity, create an instance of
IconfiedTextListAdapter, and use that instance as an adapter for you
List.

If you want more detail, email your request to
quanghuytruongd...@gmail.com

GL!
Huy

On Jun 5, 3:20 am, automerc bigautosur...@gmail.com wrote:
 Thanks for the link. I saw that the alertdialog allows us to put a
 list on the pop up window. I was wondering if there is a way to add
 images to it as well. Is it possible to associate each item on the
 list with a image so that when a item is selected a image associated
 with that item will be displayed as well by providing the url to that
 image?

 On Jun 2, 5:13 pm, Mark Murphy mmur...@commonsware.com wrote:

   I was wondering how we would attach a pop up window to a button so
   that when the button is clicked the pop up window will appear showing
   a message and still until the user closes it. How should I go about
   this and what classes should I use? Also if there are any examples for
   this it would really helpful as well. Thank you.

  AlertDialog may be what you want.

 http://developer.android.com/guide/samples/ApiDemos/src/com/example/a...

 http://developer.android.com/guide/topics/ui/dialogs.html

  --
  Mark Murphy (a Commons Guy)http://commonsware.com
  _The Busy Coder's Guide to Android Development_ Version 2.0 Available!


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



[android-developers] Re: how to create a pop up window?

2009-06-04 Thread automerc

Thanks for the link. I saw that the alertdialog allows us to put a
list on the pop up window. I was wondering if there is a way to add
images to it as well. Is it possible to associate each item on the
list with a image so that when a item is selected a image associated
with that item will be displayed as well by providing the url to that
image?

On Jun 2, 5:13 pm, Mark Murphy mmur...@commonsware.com wrote:
  I was wondering how we would attach a pop up window to a button so
  that when the button is clicked the pop up window will appear showing
  a message and still until the user closes it. How should I go about
  this and what classes should I use? Also if there are any examples for
  this it would really helpful as well. Thank you.

 AlertDialog may be what you want.

 http://developer.android.com/guide/samples/ApiDemos/src/com/example/a...

 http://developer.android.com/guide/topics/ui/dialogs.html

 --
 Mark Murphy (a Commons Guy)http://commonsware.com
 _The Busy Coder's Guide to Android Development_ Version 2.0 Available!
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: how to create a pop up window?

2009-06-02 Thread Mark Murphy

 I was wondering how we would attach a pop up window to a button so
 that when the button is clicked the pop up window will appear showing
 a message and still until the user closes it. How should I go about
 this and what classes should I use? Also if there are any examples for
 this it would really helpful as well. Thank you.

AlertDialog may be what you want.

http://developer.android.com/guide/samples/ApiDemos/src/com/example/android/apis/app/AlertDialogSamples.html

http://developer.android.com/guide/topics/ui/dialogs.html

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com
_The Busy Coder's Guide to Android Development_ Version 2.0 Available!



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