Android equivalent java.awt.Dimension

Put your problem here if it does not fit any of the other categories.

Android equivalent java.awt.Dimension

Postby yccheok » Thu Mar 01, 2012 3:28 am

I know it is pretty simple to create such class. However, instead of creating my own, I want to know, whether Android has come with any class equivalent java.awt.Dimension? The closest I can found is Camera.Size. However, I have problem (http://www.anddev.org/other-coding-problems-f5/no-enclosing-instance-of-type-camera-is-accessible-t764833.html)in creating an instance out from it.
yccheok
Junior Developer
Junior Developer
 
Posts: 10
Joined: Wed May 25, 2011 1:31 pm

Top

Re: Android equivalent java.awt.Dimension

Postby nuetronprotron » Fri Mar 02, 2012 5:41 am

Hi yccheok,
Camera.Size is a inner class in camera as outer class as its name suggests(Camera.Size),so in order to instantiate the inner class,u have to instantiate first the outer class and then have to instatntiate using that outer class object.

for example like this:
OuterClass.InnerClass innerClassObj = OuterClassObj.new InnerClass();

check out this

http://docs.oracle.com/javase/tutorial/ ... ested.html
Hope this will help u.
nuetronprotron
Developer
Developer
 
Posts: 37
Joined: Tue Jan 10, 2012 10:22 am

Re: Android equivalent java.awt.Dimension

Postby Phyll » Fri Mar 02, 2012 12:44 pm

Hi yccheok,

You are right, its pretty easy to write your own.

Here's the source for Dimension from Java:

http://kickjava.com/src/java/awt/Dimension.java.htm

And another one:

http://grepcode.com/file/repository.gre ... nsion.java

Hope this helps.

Phyll
Phyll
Master Developer
Master Developer
 
Posts: 648
Joined: Fri Oct 14, 2011 11:19 am

Top

Return to Other Coding-Problems

Who is online

Users browsing this forum: Google [Bot], MSNbot Media and 33 guests