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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T14:48:20+00:00 2026-06-05T14:48:20+00:00

I have three class in my app. First extends Activity public class TestProjActivity extends

  • 0

I have three class in my app.
First extends Activity

public class TestProjActivity extends Activity {
/** Called when the activity is first created. */
String my ="";
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);


    new Thread(new Runnable() {
        public void run() {
            Translation th = new Translation(this);
            my = th.doSomeJob();
            }
    }).start();
    Log.d("ONCREATE", my);  
}

}

Second is DBHelper

public class DBHelper {
private final Context myContext;

public DBHelper(Context context) {      
    this.myContext = context;       
}

}

and third one extends DBhelper

public class Translation extends DBHelper {


public Translation(Runnable runnable) {
    super((Context) runnable);          
    }

public String doSomeJob(){
    return "Yes I DID!";
}

}

future I will change this classes to do real job but now,
when I run this I get this error:

  • 05-11 13:15:53.003: E/AndroidRuntime(512): Uncaught handler: thread Thread-8 exiting due to uncaught exception
  • 05-11 13:15:53.028: E/AndroidRuntime(512): java.lang.ClassCastException: iKA.PROJ.TestProjActivity$1
  • 05-11 13:15:53.028: E/AndroidRuntime(512): at another.pack.Translation.(Translation.java:10)
  • 05-11 13:15:53.028: E/AndroidRuntime(512): at iKA.PROJ.TestProjActivity$1.run(TestProjActivity.java:20)
  • 05-11 13:15:53.028: E/AndroidRuntime(512): at java.lang.Thread.run(Thread.java:1096)
  • 05-11 13:15:53.053: I/dalvikvm(512): threadid=7: reacting to signal 3
  • 05-11 13:15:53.053: E/dalvikvm(512): Unable to open stack trace file ‘/data/anr/traces.txt’: Permission denied
  • 05-11 13:20:53.135: I/Process(512): Sending signal. PID: 512 SIG: 9

What do I wrong ?

  • 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-05T14:48:23+00:00Added an answer on June 5, 2026 at 2:48 pm

    You’re trying to cast your Runnable into a Context. This is not possible

    I think that you want to do is

    Translation th = new Translation(TestProjActivity.this);
    

    and

    public Translation(Context context) {
        super(context);          
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

If I have three classes class A class B extends A class C extends
I have three classes: public partial class Student : Contact { //Inherited from Contact:
Hi there I have 3 files in rails as follows: 1)Located at app/controller/listings_controller.rb class
Assume that I have three class; UserAccount, UserGroup and Role. UserGroup and Role are
I have three models: class Book < ActiveRecord::Base has_many :collections has_many :users, :through =>
I have three models: class Address < ActiveRecord::Base has_many :jobs end class Category <
I have three models: class A < ActiveRecord::Base has_many :bs end class B <
I have three models that look something like this: class Bucket < ActiveRecord::Base has_many
I have three model classes that look as below: class Model(models.Model): model = models.CharField(max_length=20,
I have three tables which are defined as: class User(Base): __tablename__ = 'users' id

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.