If you are using Internet Explorer, please remove blackberry.com from your compatibility view settings.

Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Super Contributor
lyon819
Posts: 253
Registered: ‎08-19-2010
My Device: BB10, Playbook, 9900, 9800, 9700, 9550, 9530, 9500, 8700.
My Carrier: TT

How to get length of FileConnection.list()?

[ Edited ]

Purpose: Try to transfer files by socket method.

 

For general java code:

File file = new File(filedirectory);
String[] files = file.list();
// for verify, whether file.list is work or not. proof work.
int numFiles = files.length;

 

Problem:

How to get file list's length?

Length =1 means one file.

Length =10 means 10 files in the directory.

 

BlackBerry Code:

FileConnection fc = (FileConnection)Connector.open(filePath);
files = fc.list();

int numFiles = files.length; (No this kind of coding method)

 

Thanks your attention.

 

 

-Fight with BB10
Please use plain text.