BlackBerry Forums Support Community
              

Closed Thread
 
Thread Tools
Old 04-08-2008, 01:40 AM   #1
yeresera
New Member
 
Join Date: Apr 2008
Model: 8800
PIN: N/A
Carrier: SMART
Posts: 11
Lightbulb File creation

Please Login to Remove!

does anyone able to create a file in BB using Java? I need to create a temporary file so that I can attach a message(from the inbox) to an email that im about to send.

Thanks
Offline  
Old 04-08-2008, 03:43 AM   #2
Happe79
Knows Where the Search Button Is
 
Join Date: Apr 2008
Model: 8800
PIN: N/A
Carrier: IT
Posts: 21
Default

I hope I got your point:

In order to create a file on BB you can use the FileConnection Class.

CU Happe

P.S.: I just saw your question on "my" Thread, there you find more information ;)

Last edited by Happe79; 04-08-2008 at 03:45 AM..
Offline  
Old 04-08-2008, 06:22 AM   #3
simon.hain
CrackBerry Addict
 
Join Date: Apr 2005
Location: hamburg, germany
Model: 8900
Carrier: o2
Posts: 838
Default

if you don't intend to end your application in between you don't need to save the file to disk, you can just hold it in memory as a byte-array or similar.
__________________
java developer, Devinto, hamburg/germany
Offline  
Old 04-08-2008, 07:37 PM   #4
yeresera
New Member
 
Join Date: Apr 2008
Model: 8800
PIN: N/A
Carrier: SMART
Posts: 11
Default

what i need to do is to create a custom application to create and send emails. part of this is to be able to attach some files(either a message from the inbox, call logs, contacts, an image file in the SD card). My colleagues suggested that I will read the messages from the inbox, create a file from those messages and attach the created file to the email itself. I will try the code suggested by Happe79. Another requirement is to be able to browse through the folders and manually select the file to be attached.

Thank you for the help.
Offline  
Old 04-09-2008, 12:17 AM   #5
yeresera
New Member
 
Join Date: Apr 2008
Model: 8800
PIN: N/A
Carrier: SMART
Posts: 11
Default

just a quick question.. how can i identify what i will put in the content type here:

SupportedAttachmentPart attachPart =
new SupportedAttachmentPart(multipart, contentType,
fileName, readFile(fileName));

I've tried to use: "image/jpeg" (i know that what im attaching is a jpg file). but the attachment cannot be viewed.
Offline  
Old 04-09-2008, 12:50 AM   #6
richard.puckett
Talking BlackBerry Encyclopedia
 
richard.puckett's Avatar
 
Join Date: Oct 2007
Location: Seattle, WA
Model: 9020
PIN: N/A
Carrier: T-Mobile
Posts: 212
Default

You just have to know what you're attaching. Whenever I'm not sure of the MIME type of a file extension I'll usually either Google it or check the "mime.types" file in my Apache config dir. Eg:

Code:
image/jpeg                      jpeg jpg jpe
So it seems as if your mime type is accurate. The problem is most likely somewhere else. I assume your readFile method returns a byte[]? Have you tried using a png image (or just a simple text email) instead? Work on getting a baseline.

BTW, you don't need to create any temporary files - just cache your content in memory.
__________________
Do your homework and know how to ask a good question.
Offline  
Old 04-09-2008, 01:34 AM   #7
yeresera
New Member
 
Join Date: Apr 2008
Model: 8800
PIN: N/A
Carrier: SMART
Posts: 11
Default

@richard.puckett

yes, the readFile method returns byte[]. I've used the code suggested by pa4o85. I've used image/jpeg as the content type. but to no avail.
Offline  
Closed Thread



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

Forum Jump


Armco Policies Dec 1965 Steel Plant Vintage 26 pgs booklet Butler, Pa 29th print picture

Armco Policies Dec 1965 Steel Plant Vintage 26 pgs booklet Butler, Pa 29th print

$14.99



Original New DEC Digital DCJ11-AE 57-19400-09 Vintage CPU x 1pc picture

Original New DEC Digital DCJ11-AE 57-19400-09 Vintage CPU x 1pc

$100.00



DEC / AMI 304E 21-15542-01 vintage ceramic IC - KTF11 Chip *NEW* 40278101  picture

DEC / AMI 304E 21-15542-01 vintage ceramic IC - KTF11 Chip *NEW* 40278101

$50.00



Vintage Journal Beautiful Garden Flower Embossed Leather-Antique Handmade Dec... picture

Vintage Journal Beautiful Garden Flower Embossed Leather-Antique Handmade Dec...

$27.91



Dec/Adac Corp. D4-10390 Rev 6 Model 1664ATTL Output Pulse Board 1983 (B16) picture

Dec/Adac Corp. D4-10390 Rev 6 Model 1664ATTL Output Pulse Board 1983 (B16)

$189.99



VINTAGE Bruker Board DEC W4P3042 for SpectroSpin 250 picture

VINTAGE Bruker Board DEC W4P3042 for SpectroSpin 250

$50.00







Copyright © 2004-2016 BlackBerryForums.com.
The names RIM © and BlackBerry © are registered Trademarks of BlackBerry Inc.