Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7989147
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T12:40:06+00:00 2026-06-04T12:40:06+00:00

I know that this Question is repeated but I can’t find the answer in

  • 0

I know that this Question is repeated but I can’t find the answer in the Internet.

I want to call a method from another class.

I have Class1 and Class2.

In Class 2 I have this method:

public void UpdateEmployee(){
    //some code
}

I want to call the above method from Class1.

Thanks for any answer.

—-EDIT—-

final Button btnUpdate = (Button)findViewById(R.id.btnUpd);
   btnUpdate.setOnClickListener(new View.OnClickListener() {      
     public void onClick(View v) {
             Employee updEmple = new Employee();
             updEmple.UpdateEmployee();      
            
    }
    });

—-LogCat—

05-28 16:30:44.030: E/AndroidRuntime(25198): FATAL EXCEPTION: main
05-28 16:30:44.030: E/AndroidRuntime(25198): java.lang.NullPointerException: println    needs a message
05-28 16:30:44.030: E/AndroidRuntime(25198):    at android.util.Log.println_native(Native Method)
05-28 16:30:44.030: E/AndroidRuntime(25198):    at android.util.Log.v(Log.java:116)
05-28 16:30:44.030: E/AndroidRuntime(25198):    at   and.net.Employee.UpdateEmployee(Employee.java:77)
05-28 16:30:44.030: E/AndroidRuntime(25198):    at and.net.AndActivity$2.onClick(AndActivity.java:51)
05-28 16:30:44.030: E/AndroidRuntime(25198):    at android.view.View.performClick(View.java:2485)
05-28 16:30:44.030: E/AndroidRuntime(25198):    at android.view.View$PerformClick.run(View.java:9080)
05-28 16:30:44.030: E/AndroidRuntime(25198):    at android.os.Handler.handleCallback(Handler.java:587)
05-28 16:30:44.030: E/AndroidRuntime(25198):    at android.os.Handler.dispatchMessage(Handler.java:92)
05-28 16:30:44.030: E/AndroidRuntime(25198):    at android.os.Looper.loop(Looper.java:123)
05-28 16:30:44.030: E/AndroidRuntime(25198):    at android.app.ActivityThread.main(ActivityThread.java:3683)
05-28 16:30:44.030: E/AndroidRuntime(25198):    at java.lang.reflect.Method.invokeNative(Native Method)
05-28 16:30:44.030: E/AndroidRuntime(25198):    at java.lang.reflect.Method.invoke(Method.java:507)
05-28 16:30:44.030: E/AndroidRuntime(25198):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
05-28 16:30:44.030: E/AndroidRuntime(25198):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
05-28 16:30:44.030: E/AndroidRuntime(25198):    at  dalvik.system.NativeStart.main(Native Method)
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T12:40:07+00:00Added an answer on June 4, 2026 at 12:40 pm

    You should use the following code :

    Class2 cls2 = new Class2();
    cls2.UpdateEmployee();
    

    In case you don’t want to create a new instance to call the method, you can decalre the method as static and then you can just call Class2.UpdateEmployee().

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I know that this question is repeated one. But no one could answer briefly
I know this question is overly popular, but I find nothing that addresses rewriting
I know that this question is general, but I couldn't find a tutorial or
I know that this is a repeated question. I have found very similar questions
I know that this may be an amateur question but for some reason I
i know that there isn't code inside my question, but i think this is
This is just a curiosity question. I know that Spring can be used in
I know that this question might have been asked like 100 times, but, believe
I know that this question has been asked previously, but before you give me
I know that this question has already been asked HERE but sadly none of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.