[android-developers] Re: How to call another class method.

2009-08-30 Thread Sasi Kumar

I used intent to call class.
But i want to call the function.

Give some other idea to call function.

On Aug 28, 7:07 pm, ragavendran s sraghav.ra...@gmail.com wrote:
 I think u may use like this ...Intent to call another .java class
 if successs u reply to me...thanks



  weather.java

  public class Weather extends Activity implements
  Button.OnClickListener
  {

  Intent intent = new Intent(this, homepage.class);
  startActivity(intent);

  }
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[android-developers] Re: How to call another class method.

2009-08-30 Thread Sasi Kumar

I used intent to call class.
But i want to call the function.

Give some other idea to call function.

On Aug 28, 8:24 pm, Roman ( T-Mobile USA) roman.baumgaert...@t-
mobile.com wrote:
 I am assuming that you want to get the activity eSkyGuide in the
 foreground, correct?

 In this case as ragavendran suggested, call an Intent to start up the
 new activity. Something like

        Intent eSkyGuideIntent = new Intent() ;
        eSkyGuideIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);

        eSkyGuideIntent.setClassName
 (yourPackageName.eSkyGuide,yourPackageName.eSkyGuide);

        mContext.startActivity(eSkyGuideIntent);

 Make sure that you have a valid context instance. With doing this your
 new activity should be started.

 --
 Roman Baumgaertner
 Sr. SW Engineer-OSDC
 ·T· · ·Mobile· stick together
 The views, opinions and statements in this email are those of the
 author solely in their individual capacity, and do not necessarily
 represent those of T-Mobile USA, Inc.

 On Aug 28, 7:07 am, ragavendran s sraghav.ra...@gmail.com wrote:

  I think u may use like this ...Intent to call another .java class
  if successs u reply to me...thanks

   weather.java

   public class Weather extends Activity implements
   Button.OnClickListener
   {

   Intent intent = new Intent(this, homepage.class);
   startActivity(intent);

   }
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[android-developers] Re: How to call another class method.

2009-08-30 Thread Marco Nelissen

A more general Java beginners group seems more appropriate for this question.


On Sun, Aug 30, 2009 at 8:56 PM, Sasi Kumarsasikumar.it1...@gmail.com wrote:

 I used intent to call class.
 But i want to call the function.

 Give some other idea to call function.

 On Aug 28, 8:24 pm, Roman ( T-Mobile USA) roman.baumgaert...@t-
 mobile.com wrote:
 I am assuming that you want to get the activity eSkyGuide in the
 foreground, correct?

 In this case as ragavendran suggested, call an Intent to start up the
 new activity. Something like

        Intent eSkyGuideIntent = new Intent() ;
        eSkyGuideIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);

        eSkyGuideIntent.setClassName
 (yourPackageName.eSkyGuide,yourPackageName.eSkyGuide);

        mContext.startActivity(eSkyGuideIntent);

 Make sure that you have a valid context instance. With doing this your
 new activity should be started.

 --
 Roman Baumgaertner
 Sr. SW Engineer-OSDC
 ·T· · ·Mobile· stick together
 The views, opinions and statements in this email are those of the
 author solely in their individual capacity, and do not necessarily
 represent those of T-Mobile USA, Inc.

 On Aug 28, 7:07 am, ragavendran s sraghav.ra...@gmail.com wrote:

  I think u may use like this ...Intent to call another .java class
  if successs u reply to me...thanks

   weather.java

   public class Weather extends Activity implements
   Button.OnClickListener
   {

   Intent intent = new Intent(this, homepage.class);
   startActivity(intent);

   }
 


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[android-developers] Re: How to call another class method.

2009-08-28 Thread Lutz Schönemann

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
-~--~~~~--~~--~--~---



[android-developers] Re: How to call another class method.

2009-08-28 Thread Sasi Kumar

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
-~--~~~~--~~--~--~---



[android-developers] Re: How to call another class method.

2009-08-28 Thread ragavendran s
I think u may use like this ...Intent to call another .java class
if successs u reply to me...thanks



 weather.java

 public class Weather extends Activity implements
 Button.OnClickListener
 {


 Intent intent = new Intent(this, homepage.class);
 startActivity(intent);


 }









--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[android-developers] Re: How to call another class method.

2009-08-28 Thread Roman ( T-Mobile USA)

I am assuming that you want to get the activity eSkyGuide in the
foreground, correct?

In this case as ragavendran suggested, call an Intent to start up the
new activity. Something like

   Intent eSkyGuideIntent = new Intent() ;
   eSkyGuideIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);

   eSkyGuideIntent.setClassName
(yourPackageName.eSkyGuide,yourPackageName.eSkyGuide);

   mContext.startActivity(eSkyGuideIntent);

Make sure that you have a valid context instance. With doing this your
new activity should be started.

--
Roman Baumgaertner
Sr. SW Engineer-OSDC
·T· · ·Mobile· stick together
The views, opinions and statements in this email are those of the
author solely in their individual capacity, and do not necessarily
represent those of T-Mobile USA, Inc.

On Aug 28, 7:07 am, ragavendran s sraghav.ra...@gmail.com wrote:
 I think u may use like this ...Intent to call another .java class
 if successs u reply to me...thanks



  weather.java

  public class Weather extends Activity implements
  Button.OnClickListener
  {

  Intent intent = new Intent(this, homepage.class);
  startActivity(intent);

  }


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---