[android-developers] Re: How to stop any currently played audio?

2009-07-02 Thread quanghuytruongdinh

In my memory, Android has a class that take care of device audio
stream. Maybe you can investigate on this class.

On Jul 2, 5:40 pm, hmmm akul...@mail.ru wrote:
 Hi,

 I'm developing an application which plays some music files. I want to stop 
 any other audio playback when my application starts playing the music.
 I've looked at the source code of the Music application and figured out how 
 to to pause the Music application using the intent 
 com.android.music.musicservicecommand

 But there can be many other applications which can play the music too, 
 creating their own MediaPlayer objects. Is there a way to pause or stop all 
 the msic currently being played?

 Thank you
--~--~-~--~~~---~--~~
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: ListView with different types of View's

2009-07-02 Thread quanghuytruongdinh

Build a class that extends BaseAdapter, you can customize what u want
here. Then use this class as the adapter for your ListView.

On Jul 2, 8:45 pm, ayanir ayanir...@gmail.com wrote:
 Hello for all the Android's out there,

 I'm trying to make a ListView when every item in that list can be a
 different type of View.
 for example the list could be:
 1. TextView
 2. ImageView
 3. MyCustomView

 I understands that in order to make a list I need to use an Adapter.
 the problem is that the Adapter uses a single layout for all of the
 list items, which will not support the different views.

 my goal is to make an abstract View list when I can dynamically add
 and removes items in that list (each item is a View or subclass of
 it).

 Thanks
 ayanir
--~--~-~--~~~---~--~~
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-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
-~--~~~~--~~--~--~---