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


INTEL XEON E5 2520V2 E5 2620V2 SR1AN 2.10 GHZ Core Processor 3401A832 picture

INTEL XEON E5 2520V2 E5 2620V2 SR1AN 2.10 GHZ Core Processor 3401A832

$12.00



VA Xeon Lamp ~ X6321 picture

VA Xeon Lamp ~ X6321

$179.95



INTEL C1P87A XEON PHI PROCESSOR 5110P picture

INTEL C1P87A XEON PHI PROCESSOR 5110P

$29.99



225 - LGA1366 CPU Clam Shell Case for Intel Xeon  Core i7 CPU + Anti Static Foam picture

225 - LGA1366 CPU Clam Shell Case for Intel Xeon Core i7 CPU + Anti Static Foam

$195.00



Iwill DNS-SATA E7520 Intel Chipset eATX Xeon Socket 604 Server Board picture

Iwill DNS-SATA E7520 Intel Chipset eATX Xeon Socket 604 Server Board

$195.00



NETWORK INSTRUMENT GIGASTOR- 2U (2X) XEON E5-2630- 64 GB PC3 RAM picture

NETWORK INSTRUMENT GIGASTOR- 2U (2X) XEON E5-2630- 64 GB PC3 RAM

$144.49







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