eSkyGuide.this.methodName();

This one i tryed.

but it is showing error.

please give some other suggestion

On Aug 28, 5:12 pm, Lutz Schönemann
<lutz.schoenem...@sit.fraunhofer.de> wrote:
> you need a reference to the class that contains the method you want to  
> call.
>
> To access the mehtod homepage() inside the eSkyGuide from the class  
> Weather, you need an instance of the eSkyGuide class inside the  
> instance of the Weather class.
>
> for example:
>
> public class Weather extends Activity implements  
> Button.OnClickListener {
>         private eSkyGuide meSkyGuide = new eSkyGuide();
>
>         private someMethod() {
>                 meSkyGuide.homepage();
>         }
>
> }
>
> But you shouldn't do this, because you are trying to set the content  
> view of an activity from inside an other activity. Things like  
> setContentView(), setOnClickListener(), ... should be done once at  
> creation time of an activity:
>
> public class eSkyGuide extends Activity implements  
> Button.OnCickListener {
>         public void onCreate(Bundle savedInstanceState) {
>                 setContentView(R.layout.homepage);
>                 flight_schedule=(Button)findViewById(R.id.fschedule);
>                 flight_schedule.setOnClickListener(this);
>
>                 flight_status=(Button)findViewById(R.id.fstatus);
>                 flight_status.setOnClickListener(this);
>
>                 weather=(Button)findViewById(R.id.weather);
>                 weather.setOnClickListener(this);
>         }
>
> }
>
> In addition: instead of implementing the OnClickListener interface you  
> can implement an OnClickListener like this:
>
>         flight_schedule.setOnClickListener(new OnClickListener() {
>                 public void onClick(View v) {
>                         // put your code here
>                         // to call methods of the eSkyGuide class do it like 
> this
>                         eSkyGuide.this.methodName();
>                 }
>         });
>
> Am 28.08.2009 um 13:15 schrieb Sasi Kumar:
>
>
>
> > eSkyGuide.java
>
> > public class eSkyGuide extends Activity implements
> > Button.OnClickListener
> > {
>
> > public void homepage()
> >    {
> >            setContentView(R.layout.homepage);
>
> >        flight_schedule=(Button)findViewById(R.id.fschedule);
> >        flight_schedule.setOnClickListener(this);
>
> >        flight_status=(Button)findViewById(R.id.fstatus);
> >        flight_status.setOnClickListener(this);
>
> >        weather=(Button)findViewById(R.id.weather);
> >        weather.setOnClickListener(this);
> > }
>
> > }
>
> > weather.java
>
> > public class Weather extends Activity implements
> > Button.OnClickListener
> > {
>
> > // now i want to call here...... thathomepage method.
>
> > }
>
> > can any one know about these .
> > please help in these concepts.
>
> > Thanks  in advance.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to