1. Download our Official Android App: Forums for Android!

Apps Android - Open new Activity from extends framelayout

Discussion in 'Android Development' started by simple80, Sep 23, 2012.

  1. simple80

    simple80 Lurker
    Thread Starter
    Rank:
    None
    Points:
    5
    Posts:
    3
    Joined:
    Sep 23, 2012

    Sep 23, 2012
    3
    0
    5
    Hello,

    I'm doing that sample:

    http://code.google.com/p/proyectouvipool/source/browse/trunk/Android/PFC/src/pablo/developer/BalloonOverlayView.java?r=87

    I want to change at this line

    public void onClick(View v) {layout.setVisibility(GONE);}

    to

    public void onClick(View v) {

    Intent myIntentopen = new Intent(MainActivityold.class, MainActivitynew.class);
    startActivity(myIntentopen);

    }

    but it dosn't work.

    thanks.
     

    Advertisement

  2. jonbonazza

    jonbonazza Android Expert
    Rank:
    None
    Points:
    163
    Posts:
    1,930
    Joined:
    Jul 13, 2010

    Jul 13, 2010
    1,930
    457
    163
    Male
    That's because you are Initializing your Intent object incorrectly.

    Should be:

    Code (Text):
    1.  
    2. Intent myIntentopen = new Intent(MainActivityold.this, MainActivitynew.class);
    3. startActivity(myIntentopen);
    4.  
     
  3. simple80

    simple80 Lurker
    Thread Starter
    Rank:
    None
    Points:
    5
    Posts:
    3
    Joined:
    Sep 23, 2012

    Sep 23, 2012
    3
    0
    5

    it must be getContext().startActivity(intent);

    thanks for your answer.
     

Share This Page

Loading...