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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T19:39:38+00:00 2026-06-17T19:39:38+00:00

I am new to Android, Eclipse and partly Java (decade ago I read a

  • 0

I am new to Android, Eclipse and partly Java (decade ago I read a Java book and never used it.) I am following this tutorial: http://ofps.oreilly.com/titles/9781449390501/Android_User_Interface.html

I have this code:

public class Status extends Activity implements OnClickListener, TextWatcher {
  // ...
  class PostToTwitter extends AsyncTask<String, Integer, String> {
    // ...
    protected void onPostExecute(String result) { 
      Toast.makeText(Status.this, result, Toast.LENGTH_LONG).show();
    }
  }
}

I get these errors next to the Toast.makeText line:

  • The method makeText(Context, CharSequence, int) in the type Toast is not applicable for the arguments (AsyncTask.Status, String, int)
  • No enclosing instance of the type AsyncTask.Status is accessible in scope
  1. I am not sure why I get an error?
  2. Why is it mentioning AsyncTask when I am passing the Status activity context?

I guess I am going to slap myself and say Doh! later, but I have starred myself blind at it now 🙂

  • 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-17T19:39:40+00:00Added an answer on June 17, 2026 at 7:39 pm

    You problem is that Status is a public enum of AsyncTask. So java takes not your activity as a context. Try to hold a instance of your context in your AsyncTask.

    Try this code here:

    public class Status extends Activity implements OnClickListener, TextWatcher {
      private Context context;
      public void onCreate(...) {
        context=this;
        //...
      }
    
      // ...
      class PostToTwitter extends AsyncTask<String, Integer, String> {
        // ...
        protected void onPostExecute(String result) { 
            Toast.makeText(context, result, Toast.LENGTH_LONG).show();
        }
      }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm new to Java/Eclipse/Android, so this is probably an easy (if not stupid) question:
I know that eclipse can do this, can Intellij via the new Android support
I'm new to Eclipse/Android development so I'm hoping this is something basic that I'm
When I create a new Android project in Eclipse, the following default proguard.cfg file
Hi I'm developing with new android 4.0 SDK on Eclipse. Somehow this simple if
I'm following this Android tutorial . I'm trying to find main.xml however it's not
I am new to consume web service in android eclipse.Currently i am following the
Whenever I create a new Android app and debug it using Eclipse, the following
When I start a new Android project in Eclipse (Helios), the strings.xml has 2
I am new iOS development but I know android at eclipse. For example 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.