Tuesday, February 12, 2013

getSupportFragmentManager Android development

public FragmentManager getSupportFragmentManager ()
Return the FragmentManager for interacting with fragments associated with this activity.

getSupportFragmentManager is a method from class FragmentActivity and has FragmentManager as method declaration, for this getSupportFragmentManager can access to all methods from FragmentManager.


Class A1:

package mytypecasting;
public class A1 {
      public B1 getb1(){
          B1 xxb1 = new B1();
          return xxb1;
Class B1:

package mytypecasting;

public class B1 extends A1 implements I2{ 
      public void methodI1() {
            System.out.println("I am in methodI1 of class B1");
      public void methodI2() {
            System.out.println("I am in methodI2 of class B1");
main application:

package mytypecasting;

public class MyTypecasting {

    public static void main(String[] args) {
        // TODO code application logic here
       A1 xxt = new A1();

xxt is an instance of class A1, Since getb1 is  a method of A1 and has B1 as method declaration, then getb1 can access to all methods of B1.