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


Motorola 68060 68EC060 MC68EC060RC75 CPU / Processor AMIGA unused, new USA stock picture

Motorola 68060 68EC060 MC68EC060RC75 CPU / Processor AMIGA unused, new USA stock

$69.99



New Greaseweazle V4.1 USB Floppy Adapter Flux Reader Writer Amiga 1591 picture

New Greaseweazle V4.1 USB Floppy Adapter Flux Reader Writer Amiga 1591

$28.31



New Greaseweazle V4.1 USB Floppy Adapter Flux Reader Writer Amiga PC Case 1598 picture

New Greaseweazle V4.1 USB Floppy Adapter Flux Reader Writer Amiga PC Case 1598

$36.12



New Tank Mouse White Beige USB Wireless Bluetooth 5.0 Amiga PC C64 1283 picture

New Tank Mouse White Beige USB Wireless Bluetooth 5.0 Amiga PC C64 1283

$56.63



Camera Precise Positioning Support Video Record for Acmer Laser Engraving picture

Camera Precise Positioning Support Video Record for Acmer Laser Engraving

$167.53



Camera for Laser Engraving Machine picture

Camera for Laser Engraving Machine

$207.41







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