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
Regular Contributor
Posts: 94
Registered: ‎08-07-2010
My Device: 9550

problem in using Blackberry Analytics Api in our Application

Hai,

 

 

I  want  to use Blackberry Analytics API in my application.  I have used that api in my application as ,

 

My Application Name is SampleApplication,  I want the suggestion that is this code correct. I have used the /Sample Application/ as the event path for onButtonClick event  .

 

 

------------------> My Main Class

 

 

package com.sampleapplication.ui;

 

public class Main extends WebtrendsUiApplication {
     Main() {
        pushScreen(new HomeScreen());
    }
     public static void main(String[] args) {

  
         try{


         WebtrendsConfigurator.LoadConfigFile("com.sampleapplication.ui.Main", "config.xml");
         WebtrendsDataCollector dataCollector = WebtrendsDataCollector.getInstance();
         dataCollector.Initialize();


         }catch (Exception e) {
            System.out.println("error message"+e.getMessage());
        }
        
     new Main().enterEventDispatcher();
}
}

 

-------- > my Screen Class,  HomeScreen

 

package com.sampleapplication.ui;

 

public class HomeScreen extends MainScreen {

    HomeScreen()
    {
        ButtonField click_buttonButtonField = new ButtonField("Click Me", ButtonField.CONSUME_CLICK| FOCUSABLE);
        add(click_buttonButtonField);
        
        click_buttonButtonField.setChangeListener(new FieldChangeListener() {
        public void fieldChanged(Field field, int context) {
       
            try
            {

                WebtrendsDataCollector.getInstance().onButtonClick("/Sample Application/Main/",                       "HomeScreen", "Click Me", null);

 

     Status.show("Button Field Clicked"); 
            }
            catch (IllegalWebtrendsParameterValueException err)
            {
                WebtrendsDataCollector.getLog().e(err.getMessage());
                System.out.print(err.getMessage());
            }

            }
        });
        
        
    }
}