custom bitmaps field not change image when click on

I created a custom bitmap field and I change the image on the center of my field of custom bitmaps and unfocus

but when I implement the method of navigation click to change the image when you click on this image does not change...

my custom bitmap field filed only to focus or unfocus on the image does not change my field of custom bitmaps.

Bitmap onfocus = Bitmap.getBitmapResource("111.png");
                Bitmap onunfocus = Bitmap.getBitmapResource("666.png");
                mybutton1 = new CustomBitmapField(0,"",onunfocus,onfocus,Field.FOCUSABLE){
                     protected boolean navigationClick(int status, int time) {

                         mybutton1.setBitmap(Bitmap.getBitmapResource("favu.png"));

                         return true;

                     }

                };
add(mybutton1);

and my class of field customBitmap is

public class CustomBitmapField extends BitmapField {

    Bitmap Unfocus_img, Focus_img, current_pic;
    int width;
    String text;
    Font font; 

    public CustomBitmapField(int width, String text, Bitmap onFocus, Bitmap onUnfocus, long style) {
        // TODO Auto-generated constructor stub
        super();
        Unfocus_img = onUnfocus;
        Focus_img = onFocus;
        current_pic = onFocus;
        this.text = text;
        this.width = width;

    }
    protected void layout(int width, int height)
    {
        setExtent(current_pic.getWidth(), current_pic.getHeight());
    }
    protected void paint(Graphics graphics)
    {
        /*try
        {
                FontFamily fntFamily = FontFamily.forName("BBAlpha Sans");
                font = fntFamily.getFont(Font.BOLD,14);
        }
        catch(Exception e)
        {
            font = Font.getDefault();

        }
        graphics.setFont(font);
        graphics.setColor(Color.WHITE); */
        graphics.drawBitmap(0, 0, current_pic.getWidth(), current_pic.getHeight(), current_pic, 0, 0);

        //graphics.drawText(text, width, 7);
    }
    protected void onFocus(int direction)
    {
        super.onFocus(direction);
        current_pic = Unfocus_img;

        this.invalidate();
    }
  protected void drawFocus(Graphics graphics, boolean on)
  {

    }
    protected void onUnfocus()
    {
        super.onUnfocus();
        current_pic = Focus_img;
        invalidate();
    }
    public boolean isFocusable() {
        return true;
    }
    protected boolean navigationClick(int status, int time) {

        fieldChangeNotify(0);
        return true;
    }

}

When you debug this code, which of your methods of navigationClick, is actually used?

When you expect the bitmap change, the code should lead object so that to happen.  Paint running?  This is the correct Bitmap painting?

If you answer these questions, I think that you figure to yourself what is the problem.

While you're there, you can also watch the following Threads that you have started or contributed to.  Can you solve or continue to contribute to these?

http://supportforums.BlackBerry.com/T5/Java-development/gif-animation-not-displaying-properlly/m-p/2...

http://supportforums.BlackBerry.com/T5/Java-development/timepicker-issue/m-p/2387819

http://supportforums.BlackBerry.com/T5/Java-development/ListField-focus-color-problem/m-p/2407881#m2...

Tags: BlackBerry Developers

Similar Questions

  • Custom edit field - not drawing while typing of the text

    I created a custom edit field (code below), but there is no slider or text drawn while typing.

    The text appears if you click another field on the screen, but not while typing. I guess it has something to do with my method of painting, but I don't know?

    Tips for making more effective methos painting would be a bonus!

    Thank you!

    import net.rim.device.api.system.Display;
    import net.rim.device.api.ui.Font;
    import net.rim.device.api.ui.FontFamily;
    import net.rim.device.api.ui.Graphics;
    import net.rim.device.api.ui.component.EditField;
    
    public class CustomTextField2 extends EditField {
    
        private int fieldWidth;
        private int fieldHeight;
        private int button_colour = 0xF9F9F9;
        private int text_colour = 0x666666;
        private int border_color = 0xCCCCCC;
        private Graphics graphics = null;
        public CustomTextField2(long arg0) {
            super(arg0);
            fieldWidth = Display.getWidth()-100;
            //int off = 8;
            FontFamily fFam = null;
    
            try {
                fFam = FontFamily.forName("SomeFontHere");
            }
            catch (ClassNotFoundException e) {
                e.printStackTrace();
            }  
    
            Font font = fFam.getFont(Font.PLAIN, 20);
    
            Font defaultFont = font;
            int off = 8;
            fieldHeight = defaultFont.getHeight() + off + 10;
            this.setPadding(5, 20, 5, 20);  }
    
        protected void paint(Graphics graphics) {
    
            graphics.setColor(button_colour);
            graphics.fillRect(0, 0, fieldWidth, fieldHeight);
            graphics.setColor(border_color);
            graphics.drawRect(0, 0, fieldWidth, fieldHeight);
            graphics.setColor(text_colour);
            graphics.drawText(this.getText(),20,10/2);               super.paint(this.graphics);
        }
    
        protected void onFocus(int direction) {
    
            button_colour = 0xF9F9F9;
            text_colour = 0x666666;
            border_color = 0x3598CC;
            this.invalidate();
        }
    
        protected void onUnfocus() {
    
            button_colour = 0xF9F9F9;
            text_colour = 0x666666;
            border_color = 0xCCCCCC;
            this.invalidate();
        }
    
        protected void drawFocus(Graphics graphics, boolean on) {
    
              super.drawFocus(graphics, on);
        }
    
        protected void fieldChangeNotify(int context)
        {
            try {
    
            this.getChangeListener().fieldChanged(this, context);
    
            }
            catch (Exception e){
    
            }
        }
    
        public int getPreferredHeight() {
    
            return fieldHeight;
        }
    
        public int getPreferredWidth() {
    
            return fieldWidth;
        }
    
        protected void layout(int arg0, int arg1) {
    
            setExtent(getPreferredWidth(), getPreferredHeight());
        }
    }
    

    I just posted a code in another thread - he does most, if not all, of what you want. Take a look:

    Custom elegant EditField (textbox)

  • Link color does not change after you click in Firefox for Android.

    Why the link I click does not change its color in Firefox for Android from blue to purple?

    Depends on the specificity of the site you click on links on.

  • Why is the search field not sticky more when I change the tabs?

    I'm really angry.
    One of the main reasons why I don't use IE is the always visible search box. Now, it disappears when I switch tabs! I opened several tabs and start searching in a tab after the other. Now, I have to press CTRL + f and retype the search.
    And why is the highlight and match cases button on the side right leagues from the field? I have to move the mouse away now. It is supposed to be close together so that I can move quickly. Do you have an idea of usability? You need some new ideas must spoil the browser now?
    Who decided that?

    Edited by a moderator. See the rules and lines guidelines .

    The second point in the release of Firefox 25 Notes.

    http://www.Mozilla.org/en-us/Firefox/25.0/releasenotes/

  • image bitmap field not seized touch event

    Hi all

    I've implemented a customButton class that extends from BitmapField to tuchscreen.

    The CustomField is FOCUSABLE.

    I placed 6 these customButtons in a horizontal field.

    First 3 buttons are getting clicked correctly but the last three are not capture any key event.

    The procedure is the same for all. But still this is happening.

    Can someone tell me why its happening? How can I solve this problem?

    I solved the problem

    the code is shown in the link

    http://supportforums.BlackBerry.com/T5/Java-development/capturing-click-event-of-buttons-oat-right-c...

  • Element or a field not of compensation when the page refreshes

    Hello
    I am sure that the answer is already out there and I don't know the right words to get the answer so sorry if people are required to answer this question... once again

    I have 4 parts on my page... form with the elements, report documents that displays documents saved in the database (reference to a custom table and wwv_flow_files) with a text element to remove, region to download documents and a tabular presentation. When I download a document it is a component for the user to enter a description... when the document is downloaded, this field is populated (should be cleared out). If the user deletes a document, the link they click fills an element with the name of the document which is then used in the process of doing really remove it... this question remains as crowded.

    How can I get these fields to clear?

    Thank you
    Kristina

    Kristina,

    Have you tried to create a State of Session Page process to clear the element?

    Clear Cache items (POINT, POINT, POINT) and entering a list delimited by names of elements to erase. Use a comma (,) or a colon (:)) to separate the element names.

    Example (: p1_item_1,: p1_item_2)

    Jeff

  • Chrome, not loading images when the site is online... the charge very well when working locally

    Hi, I'm working on a fairly simple site - basically just a series of images on the page, without effects, etc. Images of care very well when tested on chrome locally, but once the site is online, they do not load. see here for example

    Well seems to work on other browsers.

    Thanks for the help!

    Sorry, nevermind, seems to have suddenly started working on his own.

  • DNG files exported from the LR4 showing does not changes made when opened in PSE10?

    I have LR4, and once I do some changes that I exported the files I want to use DNG.  Then I open them in PSE10 to make final changes.  It has been working well, in fact I had an old version of Adobe Raw in my PSE on my other computer.  Then when I opened to post-secondary studies, he would ask if I wanted to convert to compatible version for editing in camera raw.  I always says no b/c I have has no need to do more raw edits.  Now that I've installed PSE on my new computer, it has the new version of ACR I guess.  When I open the DNG Edit now I no longer have this error message, but it's to show my contrast, etc. as an action setting raw instead of the changes I made in LR.  Some are like vibrance, but "recovery" that I know is "strong points" in LR, and other things are not displayed correctly.  I know that the options are different, but I don't want to use the ACR settings he uses when I open the file, or have to go through them again.  I'm not there is something I'm missing, but he cannot know.  Thanks for any help!

    There is zero advantage to sending files DNG at the PSE. As you can see, you're not see your changes and get different sliders in PSE, and indicates that certain types of ACR version mismatch. And since you say you are done making the FIRST changes, this wastes just opening time of the DNG in the PSE/ACR interface that you will not use...

    Rather than send the DNG PES files, send a TIF file to PSE using the command of Lightroom Photo-> change, and this TIF will open directly in the editor, with all of your changes from Lightroom intact PSE.

  • After expiry of the period of freeAVG, Windows security shows virus protection is disabled and does not change if I click on "update" Please help.

    My AVG free Internet security 2013 just expire and alert Security informed Windows that I have no protection against the virus.
    In another finding, I note that it says that you should not have more than one market protection, they will conflict and slow down the computer. I thought I had with Windows and Firefox. My TalkTalk broadband services provider, may also provide protection. How can I get it sorted as soon as possible with a free antivirus? I am a novice and the grandmother and worry about safety online. Thank you.

    No Trusteer Raport is completely different and concerns authorizing bank transactions.

    Also note Trusteer post report when overwhelmed sometimes is involved in Firefox crashes so if you have accidents are trying first of all the update and then if necessary uninstall Trusteer.

  • Get the application is not found error when clicking on the URL is Microsoft Mail v.6.0.6000

    Whenever I click on a URL from an email from v.6.0.6000 Microsoft Mail. I get an error that the application is not found.  This happens only in email.  I can choose a URL from Yahoo Mail and it works properly.

    Any suggestions?

    Thank you.

    Whenever I click on a URL from an email from v.6.0.6000 Microsoft Mail. I get an error that the application is not found.  This happens only in email.  I can choose a URL from Yahoo Mail and it works properly.

    Any suggestions?

    Thank you.

    Start > default programs > set your default programs > select Internet Explorer. He said "this program has all its defults?
    If not, click on 'Choose defaults for this program' > check on all the entries in the list. > Economy

    Repeat the same procedure and check if your Windows Mail has its flaws.

    t-4-2

  • Why illustrator is not preview images when you drag?

    Must be the only program on my computer other than indesign that does not allow dragged image previews, including other vector programs. Could be a reason, but none that I can think immediately, is using the user somehow, and we all material capable of it.

    For images, there is an option in the file > Document format...

    Check: Display Mode traced Images

  • I have updated to iOS to 9.3.1 now my screen is in portrait mode and will not change landscape when the phone is turned. Also, it just goes straight to voicemail without ringing on my end when people call. All I can say all the settings are correct. ideas

    Looks like my question may have been corrupted.

    I updated my phone to iOS 9.3.1 last night. Now all my incoming calls go directly to Voicemsil without ringing on my end. My sound and message settings appear normal for me. Also, my screen rotates out of sight from portrait to landscape view for photos FB etc...

    suggestions to solve problems?

    It seems that if you have the lock of portrait and do not disturb activated. Swipe up from the bottom of the screen to call the control center. Look at the two circular icons on the top right row. They are white? If so, tap on them to turn them off. One resembles a Crescent Moon, the other as an arrow in a circle with a padlock in the Center.

  • Hello, my smart phone screen does not change orientation when it turns, no matter what application is being used.

    Material: ZTE C open with Firefox OS 1.3.

    Would it be a problem with the hardware, or something is wrong in the settings?

    Thank you very much
    Thomas

    Hello

    It's all applications! But the phone has a major problem, and I decided to return.

    Thank you all for your help
    Thomas

  • Portege M700 will not change the screen orientation

    I installed the driver for the webcam for the M700, and every time I install it, I get the same error message:

    "Open Webcam driver fail - please restart camera or computer."

    I reinstalled the drivers of many times, and it still does not work.

    Therefore, I tried the msconfig method, disabled all the startup process and then reactivated their.

    The webcam shows the same error message, and now the screen will not change orientation when I rotate the screen.

    You try to use Windows XP Home edition or what? Generally, each laptop comes with preinstalled and configured operating system.

  • Receiver "warning message" that the photos could not be found and that it will not be included, when sending emails with photos?

    Original title: How can I include pictures when I send an email?

    Sometimes when I receive an email with images embedded in the e-mail message, if I send the email, the text is passed, but where the photos were in the original message, there are empty spaces or perhaps some identification confusion of where a copy of the projected image can be kept (I think - not sure). Sometimes when that happens, I get a message "warning" that the photos could not lies and will not be included.

    I tried to paste a copy of the warning above - no luck with that either.

    HELP please.

    Hi Bill,

    1 are you facing the question with any specific email account?

    2. the problem occur only when you transfer emails with photos?

    3. What is your default browser?

    4. you see a red "X" instead of a picture on Web sites also?

    Some of the sent emails will not include images when you transfer them again. You can should forward the e-mail as an attachment or, save the images to your system first and then try to attach the photo and forward the message.

    You can also check with your email provider to see if there is an option for "include images with messages" that must be activated.

    Hope the helps of information. Let us know if you need help with Windows related issues. We will be happy to help you.

Maybe you are looking for

  • HP Envy 4500: HP Envy 4500 reset admin password

    I just bought a new HP Envy 4500 and impossible to access many functions through the online web interface IP address. It keeps to a secure https version and then pops up to ask for a name and a password. I tried using admin / admin and a lot of varia

  • Where to find the manual for Satellite A200-23W

    Please; where I can't find the user manual because I have a few questions for the mouse pad and it blocks the use when the blue lights and a few other questions about the use of the buttons.

  • Need of replacement of CD/DVD for Qosmio G25

    Hello everyone I have a Qosmio G25-AV513. This is very similar to the G20. It is out of warranty. The Dvd/rw drive is a carpet * a 845 s. The trouble started just after a year of purchase. After a complete system restore and update the reader has a v

  • Shift at the choice of the steps sequence editor

    Hello all- I run into a few problems these last time with the sequence editor (TS 4.1 / LV 8.6) where by selecting some of the steps will be literally up to 30 seconds to load (instead of dry normal 1 or 2)... it seems to affect niswitch associated s

  • I uninstalled accidentally or otherwise deleted the games provided with my Aspire 5733 (window

    I uninstalled accidentally or otherwise deleted Games came with my laptop Aspire 5733 (Windows 7). Is it possible to download from the internet, or do I have to re - charge the four Acer recovery disks? (the only game I used was the heart).