BlackBerry Forums Support Community
              

Closed Thread
 
Thread Tools
Old 05-04-2009, 04:18 AM   #1
preeti
New Member
 
Join Date: Nov 2008
Model: 8310
PIN: N/A
Carrier: Developer
Posts: 2
Default Adding menu item in Email Attachment BB application

Please Login to Remove!

i m trying the following code to add menu item in attachment file view but unable to do tht :

/*
* My Attachment Viewer
*
*/

package com.samples.attachmentViewer;

import net.rim.blackberry.api.mail.*;
import net.rim.blackberry.api.mail.event.*;
import net.rim.device.api.system.*;

class MyViewer extends Application implements AttachmentHandler
{

public static void main(String args[])
{
MyViewer theApp = new MyViewer();
}

public MyViewer()
{
//Add this AttachmentHandler to the AttachmentHandlerManager
AttachmentHandlerManager m = AttachmentHandlerManager.getInstance();
m.addAttachmentHandler(this);
}

//Called when a new email message arrives to see if it is supported
//by this AttachmentHandler (this sample supports wml).
//If it is true then the menu item will be shown in the message screen.
public boolean supports(String contentType)
{

boolean val;

if (contentType.toLowerCase().indexOf("wml") != -1)
val = true;
else
val = false;

return val;
}

//Then menu item that will appear from the message screen
public String menuString()
{
return "View File";
}

//Runs when the user selects the above defined menu item
public void run(Message m, SupportedAttachmentPart p)
{
//Perform required processing on your attachment here.
//Get the attachment filename.
System.out.println("WML filename: " + p.getFilename());
//Get the attachment size.
System.out.println("Attachment size is: " + p.getSize());
//Get the contents of the attachment.
byte[] temp = (byte[])p.getContent();
String data = new String(temp);
System.out.println("Attachment Content: " + data);

}
}

Can anybody tell me where the problem is. I m using JDK 4.5 and device software version 4.5. Kindly reply as soon as possible. i also have try to made the application System module and Autorun at start up.
Please ASAP
Regards,
Preeti
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


C2102A-4 INTEL VINTAGE 1K SRAM 1024Bit CERAMIC GOLD PINS APPLE 1, DC1976 Mimeo-1 picture

C2102A-4 INTEL VINTAGE 1K SRAM 1024Bit CERAMIC GOLD PINS APPLE 1, DC1976 Mimeo-1

$30.83



Retro 1951 Apple Computer Logo 0.7mm Ballpoint Black Ink Pen Gold Barrel picture

Retro 1951 Apple Computer Logo 0.7mm Ballpoint Black Ink Pen Gold Barrel

$56.41



Lot of 6 Vintage Apple Drawstring Bags For iPhone, Mac, Apple Watch, iPod picture

Lot of 6 Vintage Apple Drawstring Bags For iPhone, Mac, Apple Watch, iPod

$45.00



Vintage Print Block “ Apple Corer Kitchen Tool “ Copper Face Block picture

Vintage Print Block “ Apple Corer Kitchen Tool “ Copper Face Block

$16.00



Vintage Food Cut-Out Display Print: Mama's Apple Pie w/Ice Cream Topper picture

Vintage Food Cut-Out Display Print: Mama's Apple Pie w/Ice Cream Topper

$19.00



COMPUTER TECH Vintage Street Sign Metal Plastic geek repair fix apple pc picture

COMPUTER TECH Vintage Street Sign Metal Plastic geek repair fix apple pc

$28.99







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