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
Developer
rcmaniac25
Posts: 1,805
Registered: ‎04-28-2009
My Device: Z10 (STL100-4)-10.2.1.3253, Z10 (STL100-3)-10.3.1.634 Dev OS, Z30 (STA100-5)-10.3.1.634 Dev OS, Passport (SQW100-1)-10.3.0.1418, PlayBook (16GB)-2.1.0.1917
Accepted Solution

API 5.0 Beta 5-FileConnection issues

First off I am testing with the 9500 simulator that comes with the Eclipse BlackBerry Java Plug-In.

 

Second, when I say root directory I mean the folder after the host (file:///SDCard/BlackBerry/ where "BlackBerry" is the root directory and host is "SDCard"). For information about path formats look at the FileConnection methods getPath, getURL, and getName. Finally the path I am using is "file:///SDCard/BlackBerry/."

 

So I have a helper library that contains a collection of file operations. I specifically made sure that I didn't use any APIs that require signing for this library (that way I can do quick updates without resigning). So I use javax.microedition.io.file.FileConnection a lot. I noticed a couple issues:

  • When I call FileConnection.exists() on the root directory and everything after it returns false.
  • When I call FileConnection.isDirectory() on the root directory and everything after it returns false.
  • When I call FileConnection.getPath() it returns the host as well as the root (supposed to come out as /BlackBerry/ as stated in getPath but instead it returns /SDCard/BlackBerry/)

 

Has anyone else noticed this or had this issue? I don't know if this is a simulator issue or a OS issue. I would test on a actual device but for whatever reason I am being told that I need to sign my helper library (I think I added a signed class for testing and forgot to remove it, but don't know where it is yet). I also don't know if it is because I am using the file system as the SDCard or because I am using a SDCard in the first place or nether of those too.

---Spends time in #blackberrydev on freenode (IRC)----
Three simple rules:
1. Please use the search bar before making new posts.
2. "Like" posts that you find helpful.
3. If a solution has been found for your post, mark it as solved.
--I code too much. Well, too bad.
Please use plain text.
Developer
rcmaniac25
Posts: 1,805
Registered: ‎04-28-2009
My Device: Z10 (STL100-4)-10.2.1.3253, Z10 (STL100-3)-10.3.1.634 Dev OS, Z30 (STA100-5)-10.3.1.634 Dev OS, Passport (SQW100-1)-10.3.0.1418, PlayBook (16GB)-2.1.0.1917

Re: API 5.0 Beta 5-FileConnection issues

I did another test on the simulator and found that when using "store" instead of "SDCard" it can view past the root directory but that isDirectory() still says a directory is not a directory. Also getPath no longer returns the host when I use "store" instead of "SDCard."

 

Does anyone know if this exists on a actual device or if it is simulator only?

---Spends time in #blackberrydev on freenode (IRC)----
Three simple rules:
1. Please use the search bar before making new posts.
2. "Like" posts that you find helpful.
3. If a solution has been found for your post, mark it as solved.
--I code too much. Well, too bad.
Please use plain text.
Developer
rcmaniac25
Posts: 1,805
Registered: ‎04-28-2009
My Device: Z10 (STL100-4)-10.2.1.3253, Z10 (STL100-3)-10.3.1.634 Dev OS, Z30 (STA100-5)-10.3.1.634 Dev OS, Passport (SQW100-1)-10.3.0.1418, PlayBook (16GB)-2.1.0.1917

Re: API 5.0 Beta 5-FileConnection issues

[ Edited ]

I found that the all the problems I came across was because I was using my computer's file system for the SDCard. If I didn't use my file system then everything works.

 

EDIT: Nevermind, the only problem fixed was the getPath() function.

---Spends time in #blackberrydev on freenode (IRC)----
Three simple rules:
1. Please use the search bar before making new posts.
2. "Like" posts that you find helpful.
3. If a solution has been found for your post, mark it as solved.
--I code too much. Well, too bad.
Please use plain text.
Developer
konic
Posts: 173
Registered: ‎06-11-2009
My Device: Not Specified

Re: API 5.0 Beta 5-FileConnection issues

I kind of don't get it, - Why SDK 5.0 is still in Beta phase?

They are already selling devices with  OS 5.0 !

Please use plain text.
Developer
rcmaniac25
Posts: 1,805
Registered: ‎04-28-2009
My Device: Z10 (STL100-4)-10.2.1.3253, Z10 (STL100-3)-10.3.1.634 Dev OS, Z30 (STA100-5)-10.3.1.634 Dev OS, Passport (SQW100-1)-10.3.0.1418, PlayBook (16GB)-2.1.0.1917

Re: API 5.0 Beta 5-FileConnection issues

No idea, all I know is before the BlackBerry Developer Conference there was SDK 5.0 Beta 4, afterwords there was SDK 5.0 Beta 5.

 

I would hope they release a final version soon but right now I just hope that certain elements (OpenGL, FileConnection when used with a file system SDCard, the GUI Builder, etc.) get implented in the simulator/Eclipse and are as close to perfect as possible so there is no disconnection between the real device and the simulator and that you can implement as many features/APIs/classes as the real OS has implemented.

 

On a different note, do you think I went overboard on the problem information?

---Spends time in #blackberrydev on freenode (IRC)----
Three simple rules:
1. Please use the search bar before making new posts.
2. "Like" posts that you find helpful.
3. If a solution has been found for your post, mark it as solved.
--I code too much. Well, too bad.
Please use plain text.
BlackBerry Development Advisor
MSohm
Posts: 14,642
Registered: ‎07-09-2008
My Device: BlackBerry Z30, BlackBerry PlayBook

Re: API 5.0 Beta 5-FileConnection issues

I haven't been able to reproduce this in the BlackBerry smartphone simulator or on a real BlackBerry smartphone.  What OS are you running on your PC?  This could be an oddity with the simulator accessing the simulated micro SD card.

Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Found a bug? Report it using Issue Tracker
Please use plain text.
Developer
rcmaniac25
Posts: 1,805
Registered: ‎04-28-2009
My Device: Z10 (STL100-4)-10.2.1.3253, Z10 (STL100-3)-10.3.1.634 Dev OS, Z30 (STA100-5)-10.3.1.634 Dev OS, Passport (SQW100-1)-10.3.0.1418, PlayBook (16GB)-2.1.0.1917

Re: API 5.0 Beta 5-FileConnection issues

I am running Windows Vista 32bit with Service Pack 2. I am running the Eclipse 1.1 plugin with Component Pack 5.0 Beta 5 and am using the simulator that came with it.

 

I have not done tried it on an actual device but on the simulator I can only create/modify/etc. files/folders. It works when the SDCard is a *.dmp file but not when it is the file system.

 

I recently found out that some of the functions I was using required the file/folder to exist and have access to it so some of the functions I had said weren't working didn't work at all unless the folder/file existed. Either way when I tried it out on the built in memory and the SDCard as a *.dmp file and a file system. As stated before the SDCard worked as a *.dmp but it also worked with the built in memory so it tells me that it has something to do with using the file system.

---Spends time in #blackberrydev on freenode (IRC)----
Three simple rules:
1. Please use the search bar before making new posts.
2. "Like" posts that you find helpful.
3. If a solution has been found for your post, mark it as solved.
--I code too much. Well, too bad.
Please use plain text.
BlackBerry Development Advisor
MSohm
Posts: 14,642
Registered: ‎07-09-2008
My Device: BlackBerry Z30, BlackBerry PlayBook

Re: API 5.0 Beta 5-FileConnection issues

I'm also seeing some issues with simulating the micro SD card using the beta 5.0 BlackBerry smartphone simulators on Windows Vista.  I have sent this issue to our development team.

Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Found a bug? Report it using Issue Tracker
Please use plain text.
Developer
rcmaniac25
Posts: 1,805
Registered: ‎04-28-2009
My Device: Z10 (STL100-4)-10.2.1.3253, Z10 (STL100-3)-10.3.1.634 Dev OS, Z30 (STA100-5)-10.3.1.634 Dev OS, Passport (SQW100-1)-10.3.0.1418, PlayBook (16GB)-2.1.0.1917

Re: API 5.0 Beta 5-FileConnection issues

Thank you. I will mark this thread solved since you found the issues with it as well and that the other issues were from not reading the documentation in depth.
---Spends time in #blackberrydev on freenode (IRC)----
Three simple rules:
1. Please use the search bar before making new posts.
2. "Like" posts that you find helpful.
3. If a solution has been found for your post, mark it as solved.
--I code too much. Well, too bad.
Please use plain text.