Display (and position) video on top of other graphical content

by Daniel » Wed, 17 Mar 2010 01:08:15 GMT

Sponsored Links

I need to display video (using the MediaPlayer API) on top of other
graphical content. I currently do this the following way:

* Create one subclass of SurfaceView, and render graphics to it using
* Create another subclass of SurfaceView, and associate a MediaPlayer
with it using MediaPlayer.setDisplay(holder), where holder is the
SurfaceHolder of the SurfaceView.
* Add both SurfaceViews to my Activity using addContentView.

This basically works; the video is displayed on top of the graphical
content and plays ok. Some problems though:

1) According to Google, multiple SurfaceViews are not supposed to be
used in a window. The fact that it works for me seems to be by chance,
and behaviour could change in future versions of Android.

2) The video is placed in the upper left corner, and I haven't found a
way to position it differently.

Any suggestions on a different approach to implement this, that would
not make use of multiple surface views, and also allow me to position
the video, would be much appreciated.



Other Threads

1. Keeping the monkey out of the preferences

My preferences section contains user names and passwords that, if
trashed, render the rest of the app non-functional. How can I keep the
testing monkey's grubby fingers out of the preferences?


2. writing Events into Google Calendar in Android failed

Hello, All:

when I insert one new Calendar Event into Google calendar from my app,
the log message was given:
10-05 00:30:44.171: ERROR/DatabaseUtils(8479): Error inserting
transparency=0 dtstart=1285891200000 title=TestCalendar _sync_dirty=1
dtend=1285891200000 visibility=0 allDay=1 lastDate=1285950628697
hasAlarm=0 eventStatus=1 into table  Events
10-05 00:30:44.171: ERROR/DatabaseUtils(8479):
android.database.sqlite.SQLiteConstraintException: error code 19:
constraint failed
10-05 00:30:44.171: ERROR/DatabaseUtils(8479):     at
android.database.sqlite.SQLiteStatement.native_execute(Native Method)

would you please tell me how to solve it?

Best Regards,


Next is my sample code:
// Platform: android 2.2 froyo

   private static final String calendarcontentStr =

   ContentValues event = new ContentValues();

   //event.put("title", mAct.getString(R.string.read) + ": " + title);
   event.put("title", "TestCalendar");

   long startTime = startC.getTimeInMillis();
   long endTime = endC.getTimeInMillis();

   event.put("dtstart", startTime);
   event.put("dtend", endTime);
   //event.put("allDay", 1);
   event.put("eventStatus", 1);
   event.put("visibility", 0);
   event.put("transparency", 0);
   event.put("hasAlarm", 0);

   Uri eventsUri = Uri.parse(calendarcontentStr);
   Uri uri = mAct.getContentResolver().insert(eventsUri, event);


3. Why the compile task in the Ant scripts is defined to compile with debug information?

4. Click on Home icon need to start application from beginning

5. USB communication

6. how to make center image bigger than rest images , in gallery

7. Show Popup in MapLocationOverlay.onTap