Question: I need to convert an Array List to Object[][], I have tried several different methods, and all seem to toss up an error or two.

My latest try is this:

```
Object[][] array = dataList.toArray(new Object[dataList.size()][]);

```

This throws the following error:

```none
java.lang.ArrayStoreException
    at java.lang.System.arraycopy(Native Method)
    at java.util.ArrayList.toArray(Unknown Source)

```

My array list is populated with classes I made, this is the class:

```
class dataClass {
    int x;
    int y;
    int z;
    String string1;
    String string2;
    Date date;
    int event;

    public dataClass(int x, int y, int z, String string1, String string2,
            Date date, int event) {
        this.x = x;
        this.y = y;
        this.z = z;
        this.string1 = string1;
        this.string2 = string2;
        this.date = date;
        this.event = event;
    }
}

```

This is how I initialize my array list:

```
public static List<dataClass> dataList = new ArrayList<dataClass>();

```

I then add my new dataClass via:

```
.add(new dataClass(...));

```

Any help would be great, thanks.

Answer: 
Swift version:

```
//AppDelegate:
    func application(application: UIApplication, supportedInterfaceOrientationsForWindow window: UIWindow?) -> Int {

        var presentedVC = application.keyWindow?.rootViewController
        while let pVC = presentedVC?.presentedViewController
        {
            presentedVC = pVC
        }
        if let pVC = presentedVC
        {
            if contains(["MPInlineVideoFullscreenViewController", "MPMoviePlayerViewController", "AVFullScreenViewController"], pVC.nameOfClass)
            {
                return Int(UIInterfaceOrientationMask.AllButUpsideDown.rawValue)
            }
        }

        return Int(UIInterfaceOrientationMask.Portrait.rawValue)
    }

//Extension:
public extension NSObject{
    public class var nameOfClass: String{
        return NSStringFromClass(self).componentsSeparatedByString(".").last!
    }

    public var nameOfClass: String{
        return NSStringFromClass(self.dynamicType).componentsSeparatedByString(".").last!
    }
}

//View controller:
    override func supportedInterfaceOrientations() -> Int {
        return Int(UIInterfaceOrientationMask.Portrait.rawValue)
    }

    override func preferredInterfaceOrientationForPresentation() -> UIInterfaceOrientation {
        return UIInterfaceOrientation.Portrait
    }

    override func shouldAutorotate() -> Bool {
        return false
    }

    override func viewWillLayoutSubviews() {
        UIApplication.sharedApplication().setStatusBarHidden(false, withAnimation: UIStatusBarAnimation.None)
    }

```
I was having the same issue and using @entropid solution I was able to fix the navigation bar problem. But my view remains below the nav bar which I fix using "sizeToFit". 

```
[[NSNotificationCenter defaultCenter] addObserverForName:@"UIWindowDidRotateNotification" object:nil queue:nil usingBlock:^(NSNotification *note) {
    if ([note.userInfo[@"UIWindowOldOrientationUserInfoKey"] intValue] >= 3) {
        [self.navigationController.navigationBar sizeToFit];
        self.navigationController.navigationBar.frame = (CGRect){0, 0, self.view.frame.size.width, 64};
    }
}];

```

I haven't tested it properly but its working for me right now