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


CH341A 24 25 Series EEPROM Flash BIOS USB Programmer Module + SOIC8 Test Clip picture

CH341A 24 25 Series EEPROM Flash BIOS USB Programmer Module + SOIC8 Test Clip

$5.88



USB BIOS EEPROM SPI FLASH Programmer CH341A 24 25 series BIOS Writer Burner Chip picture

USB BIOS EEPROM SPI FLASH Programmer CH341A 24 25 series BIOS Writer Burner Chip

$7.57



5PCS EEPROM IC ATMEL DIP-28 AT28C256 AT28C256-15PU US picture

5PCS EEPROM IC ATMEL DIP-28 AT28C256 AT28C256-15PU US

$33.99



10PCS DIP-28 Eeproms Programmable Flash Chip For SST27SF512-70-3C-PG SST 27SF512 picture

10PCS DIP-28 Eeproms Programmable Flash Chip For SST27SF512-70-3C-PG SST 27SF512

$27.89



10PCS For SST27SF512-70-3C-PG SST 27SF512 DIP-28 Eeproms Programmable Flash Chip picture

10PCS For SST27SF512-70-3C-PG SST 27SF512 DIP-28 Eeproms Programmable Flash Chip

$27.69



Eeprom Bios Usb Programador Ch341a + Soic8 Clip + 1.8V Adaptador + Soic8 Ada picture

Eeprom Bios Usb Programador Ch341a + Soic8 Clip + 1.8V Adaptador + Soic8 Ada

$23.15







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