Learn how to a build a cloud-first strategyRegister Now


Accessing variable is other calsses

Posted on 2006-05-02
Medium Priority
Last Modified: 2008-02-26
I also want to access a variable recevieBuffer or a method receivedData(). However they are in another class within the same .java file and the same project. I have a the following classes:

public class Simulation extends UiApplication
which is the class that I want to use the variable in

class SPPScreen extends MainScreen implements BluetoothSerialPortListener
which is the class that contains the variable.

How could I access the variable or the method from the Simulation class?
Question by:TheMeeser
  • 2
LVL 13

Accepted Solution

bglodde earned 1500 total points
ID: 16592467
You have a couple choices:
> Make the variable static
> Create a public accessor to retrieve the value (eg getVariableValue()) from SPPScreen.

LVL 18

Expert Comment

ID: 16597619
The meeser......you may want to grade and close some of your previous questions.......or at least respond to the advice given....before asking anymore.

Author Comment

ID: 16597858
This helped me out alot, but it took me a little bit to figure out how to do the public accessor part.


Author Comment

ID: 16597869
Thanks for the tip JConchie :) I have never used anything like this before and wasn't sure how it worked.

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When a user’s mailbox is first created and his Blackberry account enabled how do we provision the device and what happens in the background? Stage 1 – Activation The user of the BlackBerry device types the email address and activation password i…
I felt secure communicating on the BBM... Till some time back!! It was probably the fact that the BBM messages do not travel over the internet was making me feel 'secure' about it, or was it the fact that BBM only works on a BlackBerry Devices a…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
Suggested Courses

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question