-1

In class a which extends MainScreen, I want to call b class which extends MainScreen also.

When I pass b.this into a function error shown No enclosing instance of the type b is accessible in

Alan Lai
  • 1,296
  • 2
  • 12
  • 16
  • 2
    can you please provide me more information otherwise come to this room http://chat.stackoverflow.com/rooms/4014/knowledge-sharing-center-for-blackberry-android-and-java here some one can help you – Govindarao Kondala Jul 12 '12 at 07:22

2 Answers2

0

Hi this is Very simple I will tell you simple way

Suppose you have two classes

1)screen1

2)screen2

screen1.java

public class screen1 extends MainScreen
{
   // some lines of code 
   //this is method to going to next screen in side that method 
   UiApplication.getUiApplication().pushScreen(new screen2(screen1.this));
}

screen2.java

public class screen2 extends MainScreen
{
   private Screen1 screen1Object;
   // here take constructer
   public screen2(Screen1 screen1Object)
   {
      this.screen1Object=screen1Object;
   }
}

Here you can use that screen1Object

Nate
  • 31,017
  • 13
  • 83
  • 207
Govindarao Kondala
  • 2,862
  • 17
  • 27
0

you can using this code

UiApplication.getUiApplication().invokeAndWait(new Runnable() 
{   
    public void run() 
    {
        UiApplication.getUiApplication().pushScreen(new NewScreen());
    }
});
sagar
  • 153
  • 1
  • 8