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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T17:52:58+00:00 2026-06-17T17:52:58+00:00

Hoping to get into android app development so I’m doing some basic tutorials just

  • 0

Hoping to get into android app development so I’m doing some basic tutorials just now.

Just trying to get comfortable with the basics at the moment, one of which is using the Typeface class.

package org.me.myandroidstuff;

import android.os.Bundle; 
import android.app.Activity;
import android.graphics.Typeface;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;

public class HelloWorldActivity extends Activity implements OnClickListener 
{
    private View mainView;
    private TextView tbox1;
    private Button exitButton;
    @Override
 public void onCreate(Bundle savedInstanceState) 
{
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    mainView=(View)findViewById(R.id.mainView);
    mainView.setBackgroundColor(getResources().getColor(R.color.silver));

    tbox1 = (TextView)findViewById(R.id.textBox1);
    tbox1.setTypeface(Typeface.MONOSPACE);
}
}

The line

tbox1 = (TextView)findViewById(R.id.textBox1);

Has a red cross beside it (I’m using eclipse) with the error

tbox1 cannot be resolved

Its been a while since i have used java, but as i aware the following code

  1. create a new TextView object called tbox1
  2. Assigns the tbox1 object the id specified in the xml for the TextView tag in an external main.xml
  3. Then tbox1 executes the setTypeFace() method on itself?

Obviously I’m going wrong somewhere, any ideas? Something really simple no doubt…

  • 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-17T17:52:59+00:00Added an answer on June 17, 2026 at 5:52 pm

    You can’t inform us about one error and neglect the others. Look at your code.

    Besides what user370305 said, you have other problems. Namely, your Activity, according to the contract, implements OnClickListener but does not override the necessary onClick(View v) method. You must add it for the contract to be met.

    So your code should look like:

    package org.me.myandroidstuff;
    
    import android.app.Activity;
    import android.graphics.Typeface;
    import android.os.Bundle;
    import android.view.View;
    import android.view.View.OnClickListener;
    import android.widget.Button;
    import android.widget.TextView;
    
    public class HelloWorldActivity extends Activity implements OnClickListener {
        private View mainView;
    
        private TextView tbox1;
    
        private Button exitButton;
    
        /** Called when the activity is first created. */
        @Override
        public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.activity_main);
            mainView=(View)findViewById(R.id.mainView);
            mainView.setBackgroundColor(getResources().getColor(R.color.silver));
    
            tbox1 = (TextView)findViewById(R.id.textBox1);
            tbox1.setTypeface(Typeface.MONOSPACE);
        }
    
        @Override
        public void onClick(View v) {
            // TODO Auto-generated method stub
        }
    }
    

    Remember, you can’t talk about errors until you fix every other that might cause other errors to be falsely reported.

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

Sidebar

Related Questions

I am fairly new at developing for Android and was hoping to get some
I'm hoping to get some insight into an issue I've been struggling to wrap
For reasons that I won't get into here, I will be doing some new
I was hoping I could get some help with a Query I am trying
I was hoping to get some help with my SQL Server script. Basically, I
I was hoping to get some advice on what to do. I have a
I have a problem that I'm hoping to get some direction in solving -
I have a small problem that I am hoping to get some help with.
I'm not massively familiar with this design but I am hoping to get some
I've looked up a couple of documents but I was just hoping to get

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.