NullPointerException: moveFocusToFieldWithInput
I'm running in an intermittent Ref null exception using the Simulator 6.0.0.246 & 6.0.0.337 9800 Torch generic.
It happens that I drag in the space of a VerticalFieldManager which contains 2 fields or more active (for example, a BasicEditField and a PasswordEditField). For me, it looks like this method, moveFocustToFieldWithInput try to pick the closest focusable field where the user is drag and give the focus to this field.
Here's the exception stack trace (code RIM all):
Java Exception data NullPointerException No detail message net_rim_cldc-13(4C94D16C) Manager moveFocusToFieldWithInput 0x8D0A net_rim_cldc-14(4C94D16C) Screen moveFocusToFieldWithInput 0x294F net_rim_cldc-14(4C94D16C) Screen dispatchTouchEvent 0x2BF4 net_rim_cldc-15(4C94D16C) UiEngineImpl processMessage 0x6BC8 net_rim_cldc-9(4C94D16C) Application 0x2CBE net_rim_cldc-9(4C94D16C) Application processNextMessage 0x1BEA net_rim_cldc-9(4C94D16C) Application enterEventDispatcher 0x1B0F
It is quite easy to reproduce on the Simulator, but I can't reproduce it on a real device.
I was wondering:
1A anyone had this problem before and if so what did they do to solve
2 do you have any suggestions on how to intercept this exception
3 do you have any ideas on what is the source of the problem
Thanks in advance.
Thanks for your reply Mark, thank you for taking a look at this.
What follows is an application of 1 screen which reproduce this bug but also identifies what can be done to hide the bug (concealment however is hardly a real solution).
There are comments that describe how to reproduce the bug, but here they are outside of the code:
- Run the following application on a Torch 9800 Simulator (I tried two 6.0.0.246 and 6.0.0.337)
- Ensure the focus is in the area of the editor 'user_name '.
- Tap the screen just below the label of "Password".
- touch under the password field properly sets focus to the field
- ensure that you tap outside the limits of the label (which has an aqua background
- ensure that you hit the limits of the RowManager (identified by color biscuite)
You can also reproduce this bug by:
- Run the following application on a Torch 9800 Simulator (I tried two 6.0.0.246 and 6.0.0.337)
- Ensure the focus is in the area of the editor "Password."
- Tap the screen just below the label "Username".
- area affecting as the user properly sets focus the field
- ensure that you tap outside the limits of the label (which has an aqua background color)
- ensure that you hit the limits of the RowManager (identified by color biscuite)
Notes:
In this case, this bug can be 'hidden' by ensuring that the RowManager.getPreferredHeight returns the maximum value of the field's highest - by doing this that you make it impossible for the user to click below the label
package ca.focuserrorapp; import net.rim.device.api.system.Display; import net.rim.device.api.ui.Color; import net.rim.device.api.ui.Field; import net.rim.device.api.ui.Manager; import net.rim.device.api.ui.UiApplication; import net.rim.device.api.ui.XYEdges; import net.rim.device.api.ui.component.BasicEditField; import net.rim.device.api.ui.component.LabelField; import net.rim.device.api.ui.component.PasswordEditField; import net.rim.device.api.ui.container.MainScreen; import net.rim.device.api.ui.container.VerticalFieldManager; import net.rim.device.api.ui.decor.BackgroundFactory; /* * Steps to reproduce the bug described here: http://supportforums.blackberry.com/t5/Java-Development/NullPointerException-moveFocusToFieldWithInp... * * 1. Launch the following application on a Torch 9800 simulator (I've tried both 6.0.0.246 and 6.0.0.337) * 2. Ensure focus is in the 'Username' editor field * 3. Touch the screen just below the 'Password' label * - touching below the password field correctly assigns focus to the field * - ensure you touch outside the bounds of the label (which has an aqua background color) * - ensure you touch inside the bounds of the RowManager (identified by the bisque color) * * You can also reproduce this bug by: * 1. Launch the following application on a Torch 9800 simulator (I've tried both 6.0.0.246 and 6.0.0.337) * 2. Ensure focus is in the 'Password' editor field * 3. Touch the screen just below the 'Username' label * - touching below the username field correctly assigns focus to the field * - ensure you touch outside the bounds of the label (which has an aqua background color) * - ensure you touch inside the bounds of the RowManager (identified by the bisque color) * * Notes: * * In this case, this bug can be "hidden" by ensuring the RowManager.getPreferredHeight returns the max * value of it's tallest field - by doing this you make it impossible for the user to click below the label * */ public class FocusErrorApp extends UiApplication { public static void main( String[] args ) { FocusErrorApp app = new FocusErrorApp(); app.enterEventDispatcher(); } public FocusErrorApp() { this.pushScreen(new TestScreen()); } static final class TestScreen extends MainScreen { public TestScreen() { super(); this.setTitle("Focus error test application"); this.initLayout(); } protected void initLayout() { int containerWidth = 250; int containerHMargin = (Display.getWidth() - containerWidth) / 2; VerticalFieldManager uxLoginContainer = new VerticalFieldManager(); uxLoginContainer.setMargin(new XYEdges(0, containerHMargin, 0, containerHMargin)); BasicEditField uxUsername = new BasicEditField("", "", 50, BasicEditField.USE_ALL_WIDTH | BasicEditField.NO_NEWLINE | BasicEditField.NO_LEARNING | BasicEditField.NON_SPELLCHECKABLE | BasicEditField.NO_COMPLEX_INPUT); PasswordEditField uxPassword = new PasswordEditField("", "", 50, PasswordEditField.USE_ALL_WIDTH); uxLoginContainer.add(new RowManager("Username", uxUsername)); uxLoginContainer.add(new RowManager("Password", uxPassword)); this.add(uxLoginContainer); } private class RowManager extends Manager { private final LabelField uxLabel; private final Field uxEditor; public RowManager( String label, Field editor ) { super(Manager.USE_ALL_WIDTH); this.uxLabel = new LabelField(label); this.uxLabel.setBackground(BackgroundFactory.createSolidBackground(Color.AQUA)); this.uxEditor = editor; this.uxEditor.setBackground(BackgroundFactory.createSolidBackground(Color.GREENYELLOW)); this.setBackground(BackgroundFactory.createSolidBackground(Color.BISQUE)); this.add(this.uxLabel); this.add(this.uxEditor); } public int getPreferredWidth() { return Display.getWidth(); } public int getPreferredHeight() { return 50;//Math.max(this.uxLabel.getPreferredHeight(), this.uxEditor.getPreferredHeight()); } protected void sublayout( int arg0, int arg1 ) { this.setPositionChild(this.uxLabel, 0, 0); this.layoutChild(this.uxLabel, 150, this.uxLabel.getPreferredHeight()); this.setPositionChild(this.uxEditor, 155, 0); this.layoutChild(this.uxEditor, 150, this.uxEditor.getPreferredHeight()); super.setExtent(this.getPreferredWidth(), this.getPreferredHeight()); } } } }
Tags: BlackBerry Developers
Similar Questions
-
"Error 500: java.lang.NullPointerException.
"Error 500: java.lang.NullPointerException" COSA MEANS MEAN? Pole MI ESCE QUESTA WRITTEN MENTRE PER UNA DOAMANDA GRAZIE
Hello
This is an English language Forum.
Please go to
http://answers.Microsoft.com/en-us/IE/Forum?TM=1373748955969&tab=all
to select your language from this link English
You can also choose a region or language on this page:
http://support.Microsoft.com/common/international.aspx
Don
Questo e UN forum in lingua inglese.
If get di andare
http://answers.Microsoft.com/en-us/IE/Forum?TM=1373748955969&tab=all
by rates the lingua da questo link English
If Può anche rates una regione o lingua da questa pagina:
-
I just had some problem to be able to print a PDF file that has sent me a reliable source of the school. He could not open with precision and would not print. I was told a few undesirable and the part of it said:
User CMN3101E the system is unavailable due to "java.lang.NullPointerException". I then Googled that and found the I needed to have the video drivers Intel and not the versions of MS due to some problems. I went through all this mess by using Device Manager and switched 2 pieces of diff for Intel drivers Intel and not versions of MS. I also did an UPDATE MS after a reboot to ensure that another MS Update would not reinstall certain versions of MS and if he found them I wanted to mark them for future IGNORES and ignore them now.
Still no go. I need help big time. Does anyone for a small iJEFF help today¿
Hi Jeff,
1. What is the brand and model of the printer?
2. is the specific question in the PDF? Have you tried other files to print?
See the articles:
Resolve PDF printing problems
http://helpx.Adobe.com/Acrobat/KB/troubleshoot-PDF-printing-Acrobat-Reader.html
Let us know if you have other questions about Windows in the future.
-
NullPointerException when app running, but don't not during debugging
When I run my app in the Simulator I get a nulpointerexception, but when I debug in the Simulator even I get no exception. Has anyone seen this behavior before and how can I find the source of the exception?
I tried this a couple of simulators. There's a place in my code I know wherever I knocked a nullpointer but this exception is caught by the debugger with a catch (Throwable t) {...} line. Catch (Throwable) does not work in run mode?
I use JDE 5, 9550 and 9530 sims, eclipse 3.5.2 plugin 1.1 and compliance of java 1.5
By adding an extra
catch (NullPointerException e) {}
block that now my exception gets handled. The final catch blocks look like this:
try{ ... //code that throws nullpointerexception ... } catch (NullPointerException e) { lat=0; lon=0; catch (Throwable t) { lat=0; lon=0; }
Seems to me the catch (Throwable t) should work in run mode too. Is NullPointerException not a throwable in run mode?
-Peter, I did not look into the timing stuff.
-
Hi developers, RIM
I found phonelogs.addcall (Journal CallLog) seems to throw NullPointerException in Simulator for OS 5.0 beta. Could someone confirm this?
Same error occurs in swapCall() as well.
You can report bugs using the developer Issue Tracker. Please refer to this post: http://supportforums.blackberry.com/t5/Java-Development/Developer-Issue-Tracker/td-p/271768
-
java.lang.NullPointerException packaging projects
Hello
I can't pack all projects (even the self project basis created in the new blackberry) on eclipse indigo with the new plugin eclipse blackberry.
I always get this error:
null
Error
Fri 18 Nov 10:17:02 VET 2011
An internal error occurred during: «Packaging projects...» ».java.lang.NullPointerException
at net.rim.ejde.internal.H.M.getVMVersion(RIMEIDE:286)
to net.rim.ejde.internal.util.V$ _B.A(RIMEIDE:3008)
to net.rim.ejde.internal.util.V$ _B.compare(RIMEIDE:468)
at java.util.Arrays.mergeSort(Arrays.java:1270)
at java.util.Arrays.sort(Arrays.java:1210)
at java.util.Collections.sort(Collections.java:159)
at net.rim.ejde.internal.P.H.A(RIMEIDE:3054)
at net.rim.ejde.internal.P.H.A(RIMEIDE:1072)
at net.rim.ejde.internal.D.F.H(RIMEIDE:2736)
at net.rim.ejde.internal.D.F.A(RIMEIDE:3548)
at net.rim.ejde.internal.D.F.D(RIMEIDE:1478)
at net.rim.ejde.internal.D.F.D(RIMEIDE:383)
at net.rim.ejde.internal.D.A.run(RIMEIDE:1808)
at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2344)
at net.rim.ejde.internal.D.D.runInWorkspace(RIMEIDE:841)
at org.eclipse.core.internal.resources.InternalWorkspaceJob.run(InternalWorkspaceJob.java:38)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)I have tried to open the app_descriptor file, restart eclipse and I don't no succeed.
Kind regards
How were plug-ins installed? Did you use the full installer or update the site?
Have you installed both the BlackBerry Java for BlackBerry Java SDK and Eclipse plug-in?
If so, can you try to create a new workspace?
-
Newbie question - NullPointerException in enterEventDispatcher
Hello
I'm new to the Blackberry development and use the 4.6 SDK Eclipse plugin. I used the sample applications as a basis and try to add 3 buttons to my main screen. It's code to the constructor of the main screen
public MyAppScreen() { super(DEFAULT_MENU | DEFAULT_CLOSE); try{ setTitle(new LabelField("My First App", LabelField.ELLIPSIS | LabelField.USE_ALL_WIDTH)); FieldChangeListener listener = new FieldChangeListener() { public void fieldChanged(Field field, int context) { Field buttonField = (Field) field; System.out.println("Button pressed: " + buttonField.getIndex()); } }; HorizontalFieldManager hfm = new HorizontalFieldManager( Manager.HORIZONTAL_SCROLL); ImageButton commBtn = new ImageButton(Field.FOCUSABLE, "img/comm_over.png", "img/comm.png"); commBtn.setChangeListener(listener); ImageButton accBtn = new ImageButton(Field.FOCUSABLE, "img/acts_over.png", "img/acts.png"); accBtn.setChangeListener(listener); ImageButton oppBtn = new ImageButton(Field.FOCUSABLE, "img/opp_over.png", "img/opp.png"); oppBtn.setChangeListener(listener); hfm.add(commBtn); hfm.add(new RichTextField(Field.NON_FOCUSABLE)); hfm.add(accBtn); hfm.add(new RichTextField(Field.NON_FOCUSABLE)); hfm.add(oppBtn); add(hfm); } catch(Exception e){ e.printStackTrace(); } }
I call it in my UiApplication class as follows
public MyApp() { MyAppScreen homePage = new MyAppScreen(); pushScreen(homePage);}public static void main(String[] args) { MyApp app = new MyApp(); app.enterEventDispatcher();}
ImageButton is a custom class whose code I made custom buttons sample application subject to change. When I run the application, I get a NullPointerException and stacktrace illustrates the exception in the MyAppScreen paint method.
Is someone can you please tell me what could be wrong with the application.
Thank you.
@mantaker, sorry, it was just a typo. Fix the code.
Thanks for all the answers. I solved the problem. Had missed on initialization in a constructor.
I feel really stupid
-
Exception: java.lang.NullPointerException untrapped blackBerry Smartphones
When I start my BB, it gives me this untrapped exception: java.lang.NullPointerException message
When I try 2 delete a call log number even
dosent show me any more calls I madeit
Hi and welcome to the forums!
I have seen this error several times, usually with a corrupt address book.
When you start the phone it reads the address book when you delete a call containing log
you get a contact from the address book as well. Use the following procedure to resolve the issue.
Thank you
Bifocals
"The software of the device or software component of application has not, or there is corrupted data of a synchronization cable.
-
NullPointerException in screen #navigationMovement Manager
Hello
After you add a VerticalFieldManager to a screen, Manager of navigationMovement super screen throws a NullPointerException and the verticalFieldManager scroll with the trackpad of this point (using the Enter key to scroll works very well and after once the trackpad works again scroll).
I use the same model as this post defining NullField focus on the top and the bottom of the field with vertical scrolling. Has anyone have the same problems, or have any ideas on places of interest to search for?
I'm sorry, that I couldn't reproduce it with a simple example. After a few hours, I was able to solve the problem by changing the hierarchy of my screen area, adding a handler of accepting high-field the developed anything in it.
I think what he throwed NullPointerException because he could not find a field of focus when took place the first movement of the navigation, or the system has attempted to lock the focus on an element unfocusable. I have no final conclusion, I could work around it by rearranging the fields.
-
So I try to get a storage for an options screen, but apparently my method of doing this just won't work right. whenever I try to access a variable of the OptionsScreen, it is null, unless I opened the screen Options atleast once. Now, I tried to create a new instance of the OptionsScreen to see if it works... but it didn't.
The application starts on the main menu, then the next screen is screen2. You can open the Options of screen2 screen. The only way to prevent a NullPointerException is now opening the OptionsScreen atleast once
I put three categories below to view the corresponding code.
public class theApplication extends UiApplication { public static OptionsScreen options; public theApplication() { pushScreen(new MainMenu()); } public static void main(String[] Args) { // Create a new instance of the sample application theApplication theApp = new theApplication(); // Add this app to the event dispatcher theApp.enterEventDispatcher(); // Create new options screen, to attempt to // load all options from persistent store options = new OptionsScreen(); } }
final public class OptionsScreen extends MainScreen { private static PersistentObject options; /** This is the key that allows access to the settings. */ private static long optionsKey = 0x6514f426119fc864L; private static BasicEditField text; public OptionsScreen() { // Set the title setTitle("Options"); options = PersistentStore.getPersistentObject(optionsKey); setupUI(); } protected void setupUI() { retrieveData(); add(text); } private static boolean storeData() { Options newOptions = new Options(); try { synchronized(options) { newOptions.setText(text.getText()); options.setContents(newOptions); options.commit(); return true; } } catch(Exception e) { Dialog.alert("error!"); return false; } } private static void retrieveData() { Options theOptions = new Options(); try { synchronized(options) { theOptions = (Options)options.getContents(); try { text = new BasicEditField("text ", theOptions.getText());} catch(Exception e) { text = new BasicEditField("text ", ""); } } } } public void save() throws IOException { storeData(); super.save(); } }
public class Options implements Persistable { private String text; public void setText(String newText) { text = newText;} public String getText() {return text}; }
I have your OptionScreen class, do not use the bt constructor to initialize your data:
static { options = PersistentStore.getPersistentObject(optionsKey); }
I encourage you to use the Singleton patern
-
Why I get this error? (ChoiceField) .getChoiceCached (int) online: 898 NullPointerException
The ChoiceFeild object is not null.
JDE 5.0, 1.6.latest, Windows XP pro 32-bit jdk 1.3.0 eclipse plugin
The exception gives no message.
Just found the bug, here's the code.
Sort = new InData [X]; Suppose X 4 >
Type [0] =...sort [1] =...
Sort [2] =...
Sort [3] =...
That is the problem - the sorting matrix is defined over a length of X but is filled less of X items
sortChoice = new TransparentObjectChoiceField ("", sort, 0, Field.FIELD_VCENTER, orig) {}
{} public void paint (Graphics graphics)
graphics.setColor (menuTextColor);
Super.Paint (Graphics);
}
};It was hard to find because the exception was thrown only when the screen with the sortChoice object was pushed and then of course there were several of these objects on the screen so it is difficult to see who wants to go.
Thank you.
-
Package error - ripple java.lang.NullPointerException
Hello
I am facing a problem trying to package by BB10 app using the plugin of ripple and I'm having a difficult time trying to figure out what the problem given the description of the error is really generic as you can see in the newspaper.
out: [BUILD] Populating application source 2013-09-10 15:01:27 GET /ripple/build_status/5084 200 2013-09-10 15:01:27 GET /ripple/build_status/5084 200 2013-09-10 15:01:28 GET /ripple/build_status/5084 200 2013-09-10 15:01:28 GET /ripple/build_status/5084 200 2013-09-10 15:01:29 GET /ripple/build_status/5084 200 2013-09-10 15:01:29 GET /ripple/build_status/5084 200 out: [BUILD] Parsing config.xml out: [WARN] You have disabled all web security in this WebWorks application out: [WARN] Build ID set in config.xml [version], but no signing password was provided [-g]. Bar will be unsigned out: [BUILD] Generating output files 2013-09-10 15:01:30 GET /ripple/build_status/5084 200 out: [INFO] java.lang.NullPointerException out: [INFO] at com.qnx.bbt.packager.Asset.setSourcePath(Asset.java:88) at com.qnx.bbt.packager.Asset.(Asset.java:75) at com.qnx.bbt.xml.BbtExtensionXml.getAsset(BbtExtensionXml.java:571) at com.qnx.bbt.xml.BbtExtensionXml.getAssets(BbtExtensionXml.java:541) at com.qnx.bbt.packager.BbtBarValueProvider.getAssets(BbtBarValueProvider.java:202) at com.qnx.bbt.bar.BARPackager.getAssets(BARPackager.java:71) [INFO] at com.qnx.bbt.bar.BARPackager.findAsset(BARPackager.java:233) at com.qnx.bbt.bar.BARPackager.associateSourceAssets(BARPackager.java:227) at com.qnx.bbt.packager.AbstractPackager.parseDescriptorAndCreateBarManifest(AbstractPackager.java:577) out: [INFO] at com.qnx.bbt.packager.AbstractPackager.doRun(AbstractPackager.java:238) [INFO] at com.qnx.bbt.packager.AbstractPackager.runPackager(AbstractPackager.java:164) [INFO] at com.qnx.bbt.nativepackager.BarNativePackager.main(BarNativePackager.java:61) out: [ERROR] Error: null out: [ERROR] Native Packager exception occurred 2013-09-10 15:01:30 GET /ripple/build_status/5084 200 2013-09-10 15:01:31 GET /ripple/build_status/5084 200 out: [INFO] java.lang.NullPointerException [INFO] at com.qnx.bbt.packager.Asset.setSourcePath(Asset.java:88) at com.qnx.bbt.packager.Asset.(Asset.java:75) at com.qnx.bbt.xml.BbtExtensionXml.getAsset(BbtExtensionXml.java:571) out: [INFO] at com.qnx.bbt.xml.BbtExtensionXml.getAssets(BbtExtensionXml.java:541) [INFO] at com.qnx.bbt.packager.BbtBarValueProvider.getAssets(BbtBarValueProvider.java:202) [INFO] at com.qnx.bbt.bar.BARPackager.getAssets(BARPackager.java:71) [INFO] at com.qnx.bbt.bar.BARPackager.findAsset(BARPackager.java:233) out: [INFO] at com.qnx.bbt.bar.BARPackager.associateSourceAssets(BARPackager.java:227) [INFO] at com.qnx.bbt.packager.AbstractPackager.parseDescriptorAndCreateBarManifest(AbstractPackager.java:577) out: [INFO] at com.qnx.bbt.packager.AbstractPackager.doRun(AbstractPackager.java:238) at com.qnx.bbt.packager.AbstractPackager.runPackager(AbstractPackager.java:164) out: [INFO] at com.qnx.bbt.nativepackager.BarNativePackager.main(BarNativePackager.java:61) out: [ERROR] Error: null out: [ERROR] Native Packager exception occurred Done build error response - {"code":1,"msg":"[ERROR] Error: null\n[ERROR] Native Packager exception occurred\n[INFO] java.lang.NullPointerException\n[INFO] \tat com.qnx.bbt.packager.Asset.setSourcePath(Asset.java:88)\tat com.qnx.bbt.packager.Asset.(Asset.java:75)\tat com.qnx.bbt.xml.BbtExtensionXml.getAsset(BbtExtensionXml.java:571)\n[INFO] \tat com.qnx.bbt.xml.BbtExtensionXml.getAssets(BbtExtensionXml.java:541)\n[INFO] \tat com.qnx.bbt.packager.BbtBarValueProvider.getAssets(BbtBarValueProvider.java:202)\n[INFO] \tat com.qnx.bbt.bar.BARPackager.getAssets(BARPackager.java:71)\n[INFO] \tat com.qnx.bbt.bar.BARPackager.findAsset(BARPackager.java:233)\n[INFO] \tat com.qnx.bbt.bar.BARPackager.associateSourceAssets(BARPackager.java:227)\n[INFO] \tat com.qnx.bbt.packager.AbstractPackager.parseDescriptorAndCreateBarManifest(AbstractPackager.java:577)\n[INFO] \tat com.qnx.bbt.packager.AbstractPackager.doRun(AbstractPackager.java:238)\tat com.qnx.bbt.packager.AbstractPackager.runPackager(AbstractPackager.java:164)\n[INFO] \tat com.qnx.bbt.nativepackager.BarNativePackager.main(BarNativePackager.java:61)\n[ERROR] Error: null\n[ERROR] Native Packager exception occurred\n","data":null} 2013-09-10 15:01:31 GET /ripple/build_status/5084 200
I tried different solutions but nothing has changed. You have an idea that could help me to identify at least the cause of this error?
Thank you guys
Thank you for all your responses guys.
However, it seems to be that something messed up on my machine, because the same application on another laptop, performed without any problem packing.
-
Unrecoverable internal error: java.lang.NullPointerException when compiling
Recently, I changed my code, and when I am compiling it, I got this error:
Unrecoverable internal error: java.lang.NullPointerException
Previously, I had met this exception several times, but when running the application in the Simulator.
I've tried the cleaning project, cleaning the Simulator and even restart the laptop. Did not work.
The same error persists.
Maybe it's a bug in the compiler?
Finally, I found the culprit:
I put 5 large images (total size: approximately 18 MB) in the "res/img.
The solution is to load these images from an SD card.
-
Problem with a Bitmap image in a ButtonField (get a 104 NullPointerException error)
Hi, I'm a beginner in programming BlackBerry Apps, well...
I tried to create a simple ButtonField customized with a bitmap inside, but I constantly get an error 104 eception: NullPointerException, here is my code to field custom buttond.
import net.rim.device.api.ui.component.ButtonField;import net.rim.device.api.ui.Graphics;import net.rim.device.api.system.Bitmap; public class CustomButtonField extends ButtonField{ private Bitmap imagen; CustomButtonField(Bitmap imagen, long style){ super(style); this.imagen = imagen; } public int getPreferredWidth(){ return 60; } public int getPreferredHeight(){ return 60; } protected void paint(Graphics graphics) { graphics.drawBitmap(0, 0, imagen.getWidth(), imagen.getHeight(), imagen, 0, 0); } protected void layout(int width, int height) { setExtent(getPreferredWidth(), getPreferredHeight()); } }
import net.rim.device.api.ui.container.MainScreen;import net.rim.device.api.system.Bitmap; public class PruebaScreen extends MainScreen{ private CustomButtonField boton; PruebaScreen(){ Bitmap imagen = Bitmap.getBitmapResource("res/img/icon.png"); boton = new CustomButtonField(imagen, 0); add(boton); }}
I suspect that my problem is due to the method of painting or the page layout, I don't know... I hope someone can help me, thank you very much in advance.
Check if your getBitmapResource returns any non-null Bitmap image. Specify the path correctly may take a few tries ("' / res/img/icon.png '," img/icon.png", etc.")
-
NullPointerException creating a SSL30Connection (OS 5.0.0.41 9)
Hello
I'd appreciate any help on this.
Since OS 4.2.1 I used SSL30Connection to establish SSL on a SocketConnection sessions in many devices and OS versions without problem.
Recently, I updated my BlackBerry Storm 9530 to OS 5.0.0.41 9 (Platform 4.2.0.179) and started getting a NullPointerException with the same code that worked very well in other versions of the OS.
I also tried to run this application on the BlackBerry 9550 (OS 5.0.0.334) Simulator, but got the same problem.
The specific part of the code that triggers the error is quite simple:
public void run(){ try { conn = new SSL30Connection(socket, host + ":" + port, true); is = conn.openInputStream(); os = conn.openOutputStream(); info = conn.getSecurityInfo(); cert = info.getServerCertificate(); ... } catch (IOException ex) { ... }}
Here is the stack trace that I get:
Name: NullPointerException GUID: 9c3cd62e3320b498 Time: Feb 11, 2010 16:05:33 No detail message net_rim_cldc(4AE1FC51) Hashtable get 0x58A5 net_rim_crypto_2-3(4AE207FA) SSLHandshakeProtocol
0x2A40 net_rim_crypto_2-3(4AE207FA) SSLHandshakeProtocol serverCertificate 0x5E8 net_rim_crypto_2-3(4AE207FA) SSLHandshakeProtocol connect 0x1B34 net_rim_crypto_2-3(4AE207FA) SSLRecordProtocol connect 0x338D net_rim_crypto_2-2(4AE207FA) SSL30Connection 0x1552 TotalCross-2(4B74294F) SSL$1 run 0x4BD1 Any thoughts?
Thank you
Bruno.
Good news: we now have a work around for this issue (taken from https://www.blackberry.com/jira/browse/JAVAAPI-327)
Tim Windsor added a comment - February 24, 10 10:04 - edited
"A work around for this problem is to use the full connection string at the opening of the TLS10Connection, or SSL30Connection. For example, the attached test application does:
conn = (StreamConnection)Connector.open("socket://www.google.com:443;deviceside=true;interface=wifi"); log("Wrapping socket connection into TLS10Connection"); final TLS10Connection tlsConn = new TLS10Connection(conn, "www.google.com");
And it should do:
conn = (StreamConnection) Connector.open("socket://www.google.com:443;deviceside=true;interface=wifi"); log("Wrapping socket connection into TLS10Connection"); final TLS10Connection tlsConn = new TLS10Connection(conn, "socket://www.google.com:443;deviceside=true;interface=wifi");
When this issue has been resolved, the domain name can be used again. »
Maybe you are looking for
-
10.6.8 client on a XServe 2.1
I've been reviewing this topic since 5 or 6 years now, never found a definitive answer... finally decided to "put my money where my mouth is" and I bought a "Early 2008"2.1, 2.8 GHz Quad-core XServe. ". I'm trying to run the version of 'Customer' re
-
Pause a VI programmatically?
Is there a way to pause a VI programmatically? Perhaps something similar for the control of the Applicationsuperior object or node to invoke (class: VI, method: Abort VI) Ideally, I would like a user to press a button on the front panel and pause a *
-
Media Player has sound only!
Please tell me what needs my pc! I downloaded a video (movie) and it only plays the sound. I don't see anything. What should I do?
-
Hello Update the system (maintenance) does not work, when I use a message indicates that this visit as we may for the update. help please
-
I recently started using Windows 7 x 64 and I'm unable to create a network with WPA2 - Enterprise Security profile. I have a wireless card for Intel PRO/Wireless 3945ABG with 13.0.0.107 driver version. I have had no trouble to create this network i