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

  • Home
  • SEARCH
  • 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 959899
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T01:05:52+00:00 2026-05-16T01:05:52+00:00

When I try to compile to following code, I get two errors: Description Resource

  • 0

When I try to compile to following code, I get two errors:

Description Resource Path Location Type
Syntax error on token “void”, invalid Expression AsyncTask.java /AsyncTask Project/src/org/me/asynctask line 19 Java Problem

Description Resource Path Location Type
The type AsyncTask is not generic; it cannot be parameterized with arguments <TextView, Void, Void> AsyncTask.java /AsyncTask Project/src/org/me/asynctask line 25 Java Problem

package org.me.asynctask;

import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import android.widget.TextView;
import android.widget.Toast;
import android.os.*;
public class AsyncTask extends Activity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

        TextView mytextview = new TextView(this);
        TextView secondtextview = new TextView(this);

        new MyAsyncClass().execute(mytextview, void, secondtextview);
    }

    private class MyAsyncClass extends AsyncTask<TextView, Void, Void> {
    protected TextView doInBackground(TextView tv)
    {
        tv.setText("Your AsyncTask was successful!");
        return tv;
    }

    protected void onPostExecute(TextView Result)
    {
        Context context = context.getApplicationContext();
        Toast mytoast = Toast.makeText(context, "AsyncTask processing complete", Toast.LENGTH_LONG);
        mytoast.show();
    }
}

Obviously AsyncTask IS a generic (http://developer.android.com/reference/android/os/AsyncTask.html#execute(Params&#8230;) so why do I get those errors?

  • 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-05-16T01:05:52+00:00Added an answer on May 16, 2026 at 1:05 am

    There are several problems, two of which are:

    1. You defined a class AsyncTask, which hides/collides with android.os.AsyncTask. Maybe you intended to call it AsyncTaskDemo.java or AsyncTaskActivity.java or something.

    2. You’re trying to change the UI from the background thread by calling tv.setText inside of doInBackground. That defeats the purpose of AsyncTask. Code in doInBackground shouldn’t be touching the main (or ‘UI’) thread. For mid-task updates inside of doInBackground, use AsyncTask.publishProgress.

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

Sidebar

Ask A Question

Stats

  • Questions 513k
  • Answers 513k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer I used to run gtalkbots.com which was using google apps… May 16, 2026 at 5:51 pm
  • Editorial Team
    Editorial Team added an answer You need to bind an event handler Your switch was… May 16, 2026 at 5:51 pm
  • Editorial Team
    Editorial Team added an answer Autoloading is the right way to do it, but spl_autoload_register… May 16, 2026 at 5:51 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

Here's the error I get: Description: An error occurred during the compilation of a
I am getting the following error message when compiling or attempting to run my
I have two assemblies in my application. MyApplication.BO and MyApplication.GUI . I have configured
Is there a way to use the CompiledQuery.Compile method to compile the Expression associated
I have the following program. However, I can't understand why I have to pass
I'm following the MapView tutorial on the Android website [2010-08-22 11:12:24 - com.android.ide.eclipse.adt.internal.project.AndroidManifestParser] Parser
I'm currently writing a very simple game engine for an assignment and to make
I'm trying to write an implementation of a 2-3-4 tree in c++. I'm it's
I am writing an Apache module in C++. I need to store the common
I am in the middle of (trying) to create a Class Library available for

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.