Java Can't Find Symbol Errors - blackberry

I can't figure out why I keep getting the following errors with the following code:
HelloWorldApp.java:9: pushScreen(net.rim.device.api.ui.Screen) in net.rim.device.api.ui.UiApplication cannot be applied to (com.beginningblackberry.helloworld.HelloWorldMainScreen)
pushScreen(mainScreen);
HelloWorldMainScreen.java:10: cannot find symbol
symbol : method add(net.rim.device.api.ui.component.LabelField)
location: class com.beginningblackberry.helloworld.HelloWorldMainScreen
add(labelField);
\\HelloWorldApp.java
package com.beginningblackberry.helloworld;
import net.rim.device.api.ui.UiApplication;
class HelloWorldApp extends UiApplication {
HelloWorldApp() {
HelloWorldMainScreen mainScreen = new HelloWorldMainScreen();
pushScreen(mainScreen);
}
public static void main(String[] args){
HelloWorldApp app = new HelloWorldApp();
app.enterEventDispatcher();
}
}
\\ HelloWorldMainScreen.java
package com.beginningblackberry.helloworld;
import net.rim.device.api.ui.container.MainScreen;
import net.rim.device.api.ui.component.LabelField;
class HelloWorldMainScreen {
HelloWorldMainScreen() {
LabelField labelField = new LabelField("Hello World");
add(labelField);
}
}

in HelloWorldMainScreen you probably need to extend some other class or need to provide the implementation of the add()

Related

Integrate KoliBri web-components in Vaadin

I am trying to integrate KoliBri web-components (https://github.com/public-ui/kolibri) in a Vaadin project. I followed the documentation for web components integration (https://vaadin.com/docs/latest/create-ui/web-components) but I was not successful.
I want to integrate a KoliBri-button (kol-button) and therefor created getter and setter methods for the required properties of the button. When loading the website, the kol-button-component is loaded successfully from the .js file.
enter image description here
But the kol-button element in the DOM is empty and won´t show up:
enter image description here
Here is my KolButton.java:
package com.example.application.views.helloworld;
import com.vaadin.flow.component.Component;
import com.vaadin.flow.component.Synchronize;
import com.vaadin.flow.component.Tag;
import com.vaadin.flow.component.dependency.JsModule;
import com.vaadin.flow.component.dependency.NpmPackage;
#Tag("kol-button")
#NpmPackage(value = "#public-ui/components", version = "1.1.10")
#JsModule("#public-ui/components/dist/components/kol-button")
public class KolButton extends Component {
public boolean getLabel() {
return getElement().getProperty("_label", false);
}
public void setLabel(String label) {
getElement().setProperty("_label", label);
}
public void setVariant(String variant) {
getElement().setProperty("_variant", variant);
}
public boolean getVariant() {
return getElement().getProperty("_variant", false);
}
}
And the view.java:
package com.example.application.views.helloworld;
import com.example.application.views.MainLayout;
import com.vaadin.flow.component.orderedlayout.HorizontalLayout;
import com.vaadin.flow.router.PageTitle;
import com.vaadin.flow.router.Route;
import com.vaadin.flow.router.RouteAlias;
#PageTitle("Hello World")
#Route(value = "hello", layout = MainLayout.class)
#RouteAlias(value = "", layout = MainLayout.class)
public class HelloWorldView extends HorizontalLayout {
public HelloWorldView() {
var kolButton = new KolButton();
kolButton.setLabel("TestText");
kolButton.setVariant("danger");
setVerticalComponentAlignment(Alignment.END, kolButton);
add(kolButton);
}
}
Do you have any idea to solve this? Thanks in advance

Creating a blackberry app that displays ads

I've created a simple application that displays an advertisement. I used this article. I followed all steps but I get NoClassDefFound error on the BlackBerry 9900 simulator.
Update:
I have used preverify.exe to checks jar file to be compatible with net_rim_api.jar:
preverify -classpath "D:\Eclipse\plugins\net.rim.ejde.componentpack7.1.0_7.1.0.10\com
ponents\lib\net_rim_api" "net_rim_bbapi_adv_app.jar" "D:\Eclipse\plugins\net.rim.ejde.componentpack7.1.0_7.1.0.10\components\bin\output"
i am getting like this,what should i do?
Error preverifying class net.rimlib.blackberry.api.advertising.app.a
java/lang/NoClassDefFoundError: java/lang/Thread
Below, there's my code:
import net.rim.device.api.ui.UiApplication;
import net.rim.device.api.ui.container.MainScreen;
import net.rimlib.blackberry.api.advertising.app.Banner;
public class AdDemo extends UiApplication{
public static void main(String[] args)
{
AdDemo theApp = new AdDemo();
theApp.enterEventDispatcher();
}
public AdDemo()
{
pushScreen(new AdDemoScreen());
}
}
class AdDemoScreen extends MainScreen{
public AdDemoScreen()
{
Banner bannerAd = new Banner(16741, null);
bannerAd.setMMASize(Banner.MMA_SIZE_EXTRA_LARGE);
add(bannerAd);
}
}
How can I overcome this issue?
Thank you.

Trying to write a hello world CLDC blackberry program

I got the book Advance Black Berry 6 Development.
I was able to get the midlet example to work, but not the first example for a CLDC program. It seems like it never gets to the code and when I run the app I get a blank white screen.
I tried to put a break point but it never went off.
Here is the code
package test.org;
import net.rim.device.api.ui.UiApplication;
import net.rim.device.api.ui.component.*;
import net.rim.device.api.ui.container.*;
public class cHelloUniverses extends UiApplication{
public static void main(String[] args)
{
(new cHelloUniverses()).start();
}
public void start()
{
MainScreen main = new MainScreen();
LabelField label= new LabelField("Hello Ted");
main.add(label);
UiApplication app = UiApplication.getUiApplication();
app.pushScreen(main);
app.enterEventDispatcher();
}
}
Replace your start() method with this:
public void start()
{
MainScreen main = new MainScreen();
LabelField label= new LabelField("Hello Ted");
main.add(label);
this.pushScreen(main);
this.enterEventDispatcher();
}

BlackBerry app "no Application instance" error

I want this non-ui app to open from an icon press and then invoke the memopad to make a new memo.
But when I run it from the icon click I get,
""Uncaught exception: no Application instance""
What am I doing wrong? I extended the Application to say it is non-ui. The Invoke.invoke ... code is correct I know. It has something to do with the struct and instance of the app. But I'm stumped.
package mprn;
import net.rim.blackberry.api.invoke.*;
import net.rim.device.api.system.Application;
public class memopadrn extends Application
{
public static void main(String[] args)
{
Invoke.invokeApplication(Invoke.APP_TYPE_MEMOPAD, new MemoArguments(MemoArguments.ARG_NEW));
}
}
Your application never enters into the Event Dispatcher, try this (untested):
import net.rim.blackberry.api.invoke.Invoke;
import net.rim.blackberry.api.invoke.MemoArguments;
import net.rim.device.api.ui.UiApplication;
public class Memopadrn extends UiApplication {
public static void main(String[] args) {
new Memopadrn().enterEventDispatcher();
}
public Memopadrn() {
Invoke.invokeApplication(Invoke.APP_TYPE_MEMOPAD, new MemoArguments(MemoArguments.ARG_NEW));
System.exit(0);
}
}

How can I lock the keypad in Blackberry application using "lockSystem" method in J2ME?

How can I lock the keypad in Blackberry application using "lockSystem" method in J2ME ??
And also the brightness of the blackberry should reduce to Zero ??
its really easy. I know the answer. We can just use the method "lockSystem". I have coded as following to lock the keypad. It takes long time for me to find it, but u got this.
package net.asem;
import net.rim.device.api.system.ApplicationManager;
import net.rim.device.api.ui.Field;
import net.rim.device.api.ui.FieldChangeListener;
import net.rim.device.api.ui.UiApplication;
import net.rim.device.api.ui.component.ButtonField;
import net.rim.device.api.ui.component.LabelField;
import net.rim.device.api.ui.container.MainScreen;
public class LockBlackberry extends UiApplication
{
public static void main(String[] args)
{
LockBlackberry lockB = new LockBlackberry();
lockB.enterEventDispatcher();
}
LockBlackberry()
{
pushScreen(new myBlackBerryClass());
}
}
final class myBlackBerryClass extends MainScreen implements FieldChangeListener<br>
{
LabelField title;
ButtonField btn1;
myBlackBerryClass()
{
LabelField title = new LabelField("Title : Locking the Device.",LabelField.USE_ALL_WIDTH | LabelField.USE_ALL_WIDTH);
setTitle(title);
btn1 = new ButtonField("KeyPad Loack ?",ButtonField.CONSUME_CLICK);
btn1.setChangeListener(this);
add(btn1);
}
public void fieldChanged(Field field, int context)
{
if(field == btn1)
{
Click();
}
}
private void Click()
{
ApplicationManager manager = ApplicationManager.getApplicationManager();
manager.lockSystem(true);
}
}

Resources