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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T20:58:08+00:00 2026-05-18T20:58:08+00:00

Hi i have set up a custom title bar but the app crashes and

  • 0

Hi i have set up a custom title bar but the app crashes and i don’t get any error log in LogCat, i’m going crazy. Here’s is some code, can you experts see what’s wrong?

boolean isCustomTitleSupported;
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        isCustomTitleSupported = requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);
        setContentView(R.layout.about);
        customizeTitleBar("My Title");

    public void customizeTitleBar(String title){
        if(isCustomTitleSupported){
            getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.customtitlebar);
            TextView customTitleText = (TextView)findViewById(R.id.customtitle);
            customTitleText.setText(title);
            customTitleText.setTextColor(Color.WHITE);
        }
    }

customtitlebar.xml

<?xml version="1.0" encoding="UTF-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:orientation="horizontal" 
        android:layout_width="fill_parent"
        android:layout_height="fill_parent">

    <TextView android:id="@+id/customtitle"
        android:layout_width="wrap_content" 
        android:layout_height="fill_parent"
        android:textStyle="bold"
        android:padding="3px" 
        />

</LinearLayout>

some help will be appreciated

Thanks!!

EDIT: i noticed that i wasn’t extending Activity but BaseActivity a superclass i created to have the menu available in all of my activities. So i changed back to extend Activity and it’s working but this is a problem because i need menus too. Is there any tricks so i could keep extending BaseActivity and even get the title bar to work?

  • 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-18T20:58:09+00:00Added an answer on May 18, 2026 at 8:58 pm

    You are trying to extract the customtitle TextView from the wrong layout. When you use findViewById it defaults to your current activity’s layout, which you set to R.layout.about. You need to use a layout inflater to inflate R.layout.customtitlebar and then call findViewById from that (since the customtitle view is in the customtitlebar layout).

    Something like this:

    View view = getLayoutInflater().inflate(R.layout.customtitlebar);
    TextView customTitleText = (TextView)view.findViewById(R.id.customtitle);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a custom title bar set on my TabActivity. The custom title bar
I have set onItemClicklistener on my custom list view but onItemClicklistener not working I
So i have just set new Error Handlers in httpd.conf for custom error pages:
I have an application which uses a custom title bar. However, when my application
I have a form that I would like to draw a custom title bar
I have set my default-input-method variable to english-dvorak: (custom-set-variables '(default-input-method english-dvorak)) When I launch
Say I have a set myset of custom objects that may be equal although
I have a custom UITableViewCell subclass. I have set the contentView of my cell
I have a function that I set custom key and value to it and
In my installer I have set WixUIBannerBmp to point to my own custom dialog-banner.bmp

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.