Football Fans: Download the 2012 Schedule App from Google Play!


Go Back   Android Forums > Android Development > Application Development > Developer 101

Developer 101 101 Tutorials



Reply
 
LinkBack Thread Tools
Old November 27th, 2011, 07:40 PM   #1 (permalink)
Junior Member
 
Join Date: Jan 2011
Posts: 40
 
Device(s):
Thanks: 0
Thanked 0 Times in 0 Posts
Post asFloatBuffer

I want to convert a ByteBuffer to hold Floats. I noticed the method ByteBuffer.asFloatBuffer() would do the job but it's declared as abstract. Does this mean that I need to provide an implementation of the method somewhere? If so, how would you implement this? If not, where would the implementation be provided? Thanks for your help.

jcarsw04 is offline  
Reply With Quote
Sponsors
Old November 28th, 2011, 03:04 PM   #2 (permalink)
Premium Member
 
Join Date: Oct 2011
Location: Sydney, Australia
Posts: 193
 
Device(s): Galaxy Nexus GSM
Thanks: 2
Thanked 37 Times in 33 Posts
Default

You can't have an actual ByteBuffer object because the ByteBuffer class is abstract. What you'll actually have an object of a concrete subclasss of ByteBuffer. This subclass will have provided the implementation of asFloatBuffer().

Note that asFloatFloat() won't convert the underlying bytes from chars to floats. It will just return an object which will be a concrete subclass of FloatBuffer, and that will simply just start interpreting the remaining, unread bytes in the buffer as floats instead of as chars.
jiminaus is offline  
Reply With Quote
Reply

Bookmarks


Go Back   Android Forums > Android Development > Application Development > Developer 101 User CP
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -5. The time now is 08:17 PM.
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.
Custom vBulletin Skins by: Relivo