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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T18:42:07+00:00 2026-06-17T18:42:07+00:00

I have a PreferenceScreen and then dynamically create a PreferenceCategory, and on this category

  • 0

I have a PreferenceScreen and then dynamically create a PreferenceCategory, and on this category I set the layout newCategory.setLayoutResource(<PackageName>.R.Layout.myLayout);. The layout is a couple of TextView’s and a button. When I try to change the text of these TextViews TextView tvTextView = (TextView) findViewById(<PackageName>.R.id.tvTextView); tvTextView.setText("Test"); I get java.lang.NullPointerException. I have no idea what the hell is going on, and I am pulling my hair out, it must be something very simple I am not getting.

Log Cat: Hope this is the right stuff I am meant to copy =S

12-16 23:25:23.450: E/AndroidRuntime(5412): FATAL EXCEPTION: main
12-16 23:25:23.450: E/AndroidRuntime(5412): java.lang.NullPointerException
12-16 23:25:23.450: E/AndroidRuntime(5412):     at <PackageName>.GpsLocation$2.onClick(GpsLocation.java:190)
12-16 23:25:23.450: E/AndroidRuntime(5412):     at com.android.internal.app.AlertController$ButtonHandler.handleMessage(AlertController.java:158)
12-16 23:25:23.450: E/AndroidRuntime(5412):     at android.os.Handler.dispatchMessage(Handler.java:99)
12-16 23:25:23.450: E/AndroidRuntime(5412):     at android.os.Looper.loop(Looper.java:144)
12-16 23:25:23.450: E/AndroidRuntime(5412):     at android.app.ActivityThread.main(ActivityThread.java:4937)
12-16 23:25:23.450: E/AndroidRuntime(5412):     at java.lang.reflect.Method.invokeNative(Native Method)
12-16 23:25:23.450: E/AndroidRuntime(5412):     at java.lang.reflect.Method.invoke(Method.java:521)
12-16 23:25:23.450: E/AndroidRuntime(5412):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:858)
12-16 23:25:23.450: E/AndroidRuntime(5412):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
12-16 23:25:23.450: E/AndroidRuntime(5412):     at dalvik.system.NativeStart.main(Native Method)

The line 190 has tvTextView.setText("Test");, that’s where the error is happening apparently.

  • 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-17T18:42:08+00:00Added an answer on June 17, 2026 at 6:42 pm

    Thanks guys for helping out with speedy replies, but I figured out a different approach. Thanks for your time.

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

Sidebar

Related Questions

I have the following code in my application in res/xml/preferences.xml: <PreferenceScreen xmlns:android=http://schemas.android.com/apk/res/android> <PreferenceCategory android:title=Wi-Fi
I have a preference screen like this: <PreferenceScreen xmlns:android=http://schemas.android.com/apk/res/android > <CheckBoxPreference android:title = Turn
I have a simple preference screen defined like this <PreferenceScreen xmlns:android=http://schemas.android.com/apk/res/android> <PreferenceCategory android:title=Security> <CheckBoxPreference
I have a PreferenceScreen made with a custom ListPreference and a CheckBoxPreference. This is
<PreferenceScreen xmlns:android=http://schemas.android.com/apk/res/android> <PreferenceCategory android:title=First Category android:textSize=20px> <CheckBoxPreference android:title=Checkbox Preference android:defaultValue=false android:summary=This preference can be
How do you remove the category bar that displays in the PreferenceScreen? I have
I have the following XML. <?xml version=1.0 encoding=utf-8?> <PreferenceScreen xmlns:android=http://schemas.android.com/apk/res/android> <PreferenceCategory android:title=@string/preference_xxx_category> <CheckBoxPreference android:title=@string/preference_xxx_dual_mode_title
I need help with preferences. I need to create them programmatically. I have this
have written this little class, which generates a UUID every time an object of
have a problem. At first look at this HTML <div id=map style=background-image: url(map.png); width:

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.