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 8816935
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T04:44:04+00:00 2026-06-14T04:44:04+00:00

How to call non static method in android ?? I have try all way

  • 0

How to call non static method in android ?? I have try all way I can, but nothing. i have try this code in java and success for running, but why in android always error.
Here is the code of main activity.

public class Main extends Activity{
private Coba mstatus;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
    }
    public void onClick(View v) 
        {
        switch (v.getId()){
        case R.id.download:
                    ....

                    break;

        case R.id.resume:
            mstatus.resume();
            break;

        }
}

This is the second class.

public abstract class Coba implements runnable{

....

public void resume(){
download();
}
public void download() {
mThread = new Thread(this);
mThread.start();
}    

}

I want to call resume() method. In my source code nothing warning and error but when I try to call this method it’s always force close. Is there another way to call non static method from another class ??

  • 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-14T04:44:04+00:00Added an answer on June 14, 2026 at 4:44 am

    It’s rather a java issue than an Android one:

    First Coba is abstract so you should use a non abstract class, let’s call this class CobaImpl
    or make Coba a non abstract class (you choose).

    Second you should create an instance of the class to use a non static method (eg mstatus = new CobaImpl(…) elsewhere you can use only static method.

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

Sidebar

Related Questions

Can I call(access) non static method from static method ?? Like I have static
I want to call a non-static method on Android using JNI. I can call
I have a use case where I need to call a (non-static) method in
I'm getting an error when I try to call a non-static method in a
Possible Duplicate: Call non-static method from static method c# We can call non-static method
I can't seem to figure out how to call a Non-Static method (Instance Method)
I can't figure out why this error in php 5.4. Strict Standards: Non-static method
I have ajax code for asp.net (non-mvc) to call to a webMethod to get
I've purchased a non-consumable product using my test user, but when I call this:
Disclaimer: This code is copied from synchronized blocks for static and non-static methods I

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.