Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Trusted Contributor
pigling
Posts: 104
Registered: ‎02-05-2012
My Device: Bold 9900 (primary) Z10 LE (secondary)
My Carrier: Singtel

fail to run Advanced UI example

Hi,

I am a beginner for blackberry development (java). I have experience of C/C++, Qt/QML but no Java skill. I have successfully played with other examples on simulator and device. However, I downloaded the code from Github and import to Blackberry Eclipse Plug-in (Version 1.5.0) with JDK 6.0 and 7.0. It fails to run on simulator or device and errors:

 

Error: Cannot run program "jar": CreateProcess error=2, ?????????

 But when I run other blackberry java examples created directly from Eclipse, there is no error. How to solve this? Thanks.

 

regards,

QC

Please use plain text.
Developer
simon_hain
Posts: 15,863
Registered: ‎07-29-2008
My Device: Z10 LE
My Carrier: O2 Germany

Re: fail to run Advanced UI example

this should help you out:
http://supportforums.blackberry.com/t5/Java-Development/I-O-Error-CreateProcess/ta-p/445949

you'll also get a lot of results by just googling after the error message
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Please use plain text.
Trusted Contributor
pigling
Posts: 104
Registered: ‎02-05-2012
My Device: Bold 9900 (primary) Z10 LE (secondary)
My Carrier: Singtel

Re: fail to run Advanced UI example

[ Edited ]

Thanks for your advice, Simon.

I have searched the issue through google. But I want to know why other java blackberry examples created directly through "Import Blackberry examples" don't have this problem. If I need to edit the environment path to correct this thing, why those examples can run successfully without Path setting? Is there a way to specifically configure the path for one java project in Eclipse? Sorry for the stupid question but I am not sure if Java project can be done as the same way as C++ project in Eclipse.

Please use plain text.
Developer
simon_hain
Posts: 15,863
Registered: ‎07-29-2008
My Device: Z10 LE
My Carrier: O2 Germany

Re: fail to run Advanced UI example

hard to say, maybe the build settings are different.
on both projects:
right-click the project, choose properties, choose java build path, choose libraries, then compare the settings.

did you create the project using file -> new -> other -> BlackBerry Project? if not, try this and copy the classes over there.
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Please use plain text.
Developer
MohammedAziz
Posts: 139
Registered: ‎02-23-2012
My Device: Blackberry bold
My Carrier: Vodafone India

Re: fail to run Advanced UI example

After downloading the zip file from Github, you can copy the classes which you require like I copied ListStyleField and SliderField java files and pasted that in my application(src folder), then you need to copy images as well which is already there in that zip file.

 

Check the below code.

 

getMainManager().setBackground(
				BackgroundFactory.createSolidBackground(Color.ORANGE));

		VerticalFieldManager verticalFieldManager = new VerticalFieldManager();

		SwitchField switchField = new SwitchField(
				Bitmap.getBitmapResource("switch_left.png"),
				Bitmap.getBitmapResource("switch_right.png"),
				Bitmap.getBitmapResource("switch_left_focus.png"),
				Bitmap.getBitmapResource("switch_right_focus.png"), true);

		ListStyleButtonSet listStyleButtonSet = new ListStyleButtonSet();

		listStyleButtonSet.add(new ListStyleButtonField(" First Button ",
				Bitmap.getBitmapResource("icon.png")));
		listStyleButtonSet.add(new ListStyleButtonField(" Second Button ",
				Bitmap.getBitmapResource("icon.png")));

		listStyleButtonSet.select(true);

		verticalFieldManager.add(listStyleButtonSet);

		verticalFieldManager.add(new SeparatorField());

		verticalFieldManager.add(switchField);

		verticalFieldManager.add(new SeparatorField());

		PillButtonField pillButtonField = new PillButtonField("Hello");
		PillButtonField pillButtonField1 = new PillButtonField("Hello 1");
		PillButtonField pillButtonField2 = new PillButtonField("Hello 2");

		PillButtonSet pillButtonSet = new PillButtonSet();

		pillButtonSet.add(pillButtonField);
		pillButtonSet.add(pillButtonField1);
		pillButtonSet.add(pillButtonField2);

		verticalFieldManager.add(pillButtonSet);

		verticalFieldManager.add(new SeparatorField());

		SliderField sliderField = new SliderField(
				Bitmap.getBitmapResource("slider2_thumb_normal.png"),
				Bitmap.getBitmapResource("slider2_progress_normal.png"),
				Bitmap.getBitmapResource("slider2_base_normal.png"),
				Bitmap.getBitmapResource("slider2_thumb_normal.png"),
				Bitmap.getBitmapResource("slider2_progress_focused.png"),
				Bitmap.getBitmapResource("slider2_base_focused.png"),
				Bitmap.getBitmapResource("slider2_thumb_pressed.png"),
				Bitmap.getBitmapResource("slider2_progress_pressed.png"),
				Bitmap.getBitmapResource("slider2_base_pressed.png"), 8, 4, 10,
				10, 0);

		int i = sliderField.getNumValues();

		verticalFieldManager.add(sliderField);

		verticalFieldManager.add(new SeparatorField());

		RatingField ratingField = new RatingField(
				Bitmap.getBitmapResource("rating_star.png"),
				Bitmap.getBitmapResource("rating_dot.png"),
				Bitmap.getBitmapResource("rating_star_focus.png"),
				Bitmap.getBitmapResource("rating_dot_focus.png"), 6, 1, 0);

		verticalFieldManager.add(ratingField);

		verticalFieldManager.add(new SeparatorField());

		HyperlinkButtonField hyperlinkButtonField = new HyperlinkButtonField(
				"This is a hyper link button", Color.WHITESMOKE, Color.BLUE,
				1230, 10);
		
		hyperlinkButtonField.setChangeListener(new FieldChangeListener() {
			
			public void fieldChanged(Field field, int context) {
				
				Dialog.alert("You Clicked hyper link");
				
			}
		});
		
		verticalFieldManager.add(hyperlinkButtonField);
		
		verticalFieldManager.add(new SeparatorField());
		
		onUiEngineAttached(true);

		add(verticalFieldManager);

 

Like this you can use any class from AdvancedUi design api from Github.

 

Hope this help you

 

Thank you

 

warm regards
Mohammed Aziz
Please use plain text.
Trusted Contributor
pigling
Posts: 104
Registered: ‎02-05-2012
My Device: Bold 9900 (primary) Z10 LE (secondary)
My Carrier: Singtel

Re: fail to run Advanced UI example

I created the project using: file -> import -> existing projects into workspace.
If I create the project using: file -> import -> blackberry legacy project, it will need a .jdw workspace file which doesn't exit in the source code.
If I create the project using: file -> new -> blackberry, it will create a new class.
In fact, I am trying to design a UI for my application and don't like the predefined the UI class in the development doc. So I want to check this advanced UI for inspiration.
Where can I chech the advanced UI without compiling the source code? Thanks.
Please use plain text.
Trusted Contributor
pigling
Posts: 104
Registered: ‎02-05-2012
My Device: Bold 9900 (primary) Z10 LE (secondary)
My Carrier: Singtel

Re: fail to run Advanced UI example

[ Edited ]
Please use plain text.
Developer
MohammedAziz
Posts: 139
Registered: ‎02-23-2012
My Device: Blackberry bold
My Carrier: Vodafone India

Re: fail to run Advanced UI example

do you want to create an advanced UI design without using the predefined classes available at GItHub?
warm regards
Mohammed Aziz
Please use plain text.