Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8581523
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T21:04:24+00:00 2026-06-11T21:04:24+00:00

I have created a button in my Screen constructor, but when I click on

  • 0

I have created a button in my Screen constructor, but when I click on the button, my event is not executing, why could that be

My code is:

public myScreen(){
    _startPlayingButton = new ButtonField("Play/pause");


            _startPlayingButton.setChangeListener(new FieldChangeListener() {

                public void fieldChanged(Field field, int context) {
                    try {
                        // If the START button was pressed, begin playback
                        if (field == _startPlayingButton) {
                            // The player does not exist, we must initialize it
                            if (result) {
                                System.out.println("Result1" + result);
                                if (_player == null) {
                                    // Create a stream using the remote file.
                                    _source = new ShoutcastStream(_urlField.getText());

                                    UiApplication.getUiApplication().invokeLater(
                                            new Runnable() {
                                                public void run() {
                                                    // Update the player status
                                                    // _playStatusField.setText("Started");
                                                }
                                            });

                                    // Create and run the player's thread
                                    _playerThread = new PlayerThread();
                                    if (_playerThread != null) {
                                        _playerThread.start();
                                    } else {
                                        System.out.println("PlayerThread is null.");
                                    }
                                }
                                // The player already exists, simply resume it
                                else {
                                    _player.start();
                                }
                                result = false;

                            } else {
                                // Acquire the UI lock
                                System.out.println("Result2" + result);


                                 UiApplication.getUiApplication().invokeLater(new
                                  Runnable() { public void run() { 


                                 ("Stopped"); } });
                                  }
                                 });
                                // Destroy the Player and streams
                                destroy();
                                result = true;
                            }
                        }
                        // If the STOP button was pressed:

                    } catch (IOException ioe) {
                        ioe.printStackTrace();
                        errorDialog(ioe.toString());
                    } catch (MediaException e) {
                        // TODO Auto-generated catch block
                        e.printStackTrace();
                        System.out.println(e);
                    }

                }
            });
            add(_startPlayingButton);
}
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T21:04:25+00:00Added an answer on June 11, 2026 at 9:04 pm

    Try with this:

     _startPlayingButton = new ButtonField("Play/pause")
    {
        protected boolean navigationClick(int status, int time) 
        {
            fieldChangeNotify(1);
            return true;
        }
    };
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have created one play button using ButtonField on blackberry screen, if I click
I have created a button CSS class that uses background images with different positions
I have created a button. So when I click the button it gives me
I have created a button in my screen's XML like this: <Button android:text=Lets Get
I have created a GUI calculator (a screen shot included) and when a button
I have created a screen using Objective-C in an iPhone project. In that, there
I have created button 2 below: <input id=Button1 type=button value=Stop onclick=alert('hello world');/> <input id=Button2
I have created a button in my Android application & I tried to set
I have created a button which I want to expand/contract. I found a way
I have a Main class and a HelloWorld class. I have created a button

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.