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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T14:33:39+00:00 2026-05-30T14:33:39+00:00

I’m trying to create an intent to a new activity on an application but

  • 0

I’m trying to create an intent to a new activity on an application but a null pointer exception is thrown when the activity is created, which forces the emulator to close. Any ideas?

    ...
    ...
//connect objects with the xml view
searchbar = (EditText) findViewById(R.id.searchtxt);
btmsearch = (Button) findViewById(R.id.searchbtm);
searchopt = (TextView) findViewById(R.id.advsearchtxt);

searchopt.setOnClickListener(new View.OnClickListener() { 
       public void onClick(View v) {
        // TODO Auto-generated method stub
        Intent bi = new Intent(getApplicationContext(), adv_search.class);
        startActivity(bi);
    }
});
//make the search when click on search buttom
btmsearch.setOnClickListener(new View.OnClickListener() {

    ...
    ...

The logcat of the application is the follwing:

02-29 19:54:42.313: D/AndroidRuntime(628): Shutting down VM
02-29 19:54:42.313: W/dalvikvm(628): threadid=3: thread exiting with uncaught exception (group=0x4001aa28)
02-29 19:54:42.313: E/AndroidRuntime(628): Uncaught handler: thread main exiting due to uncaught exception
02-29 19:54:42.323: E/AndroidRuntime(628): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.remotedata.firstapp/com.remotedata.firstapp.DataconectActivity}: java.lang.NullPointerException
02-29 19:54:42.323: E/AndroidRuntime(628):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2401)
02-29 19:54:42.323: E/AndroidRuntime(628):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2417)
02-29 19:54:42.323: E/AndroidRuntime(628):  at android.app.ActivityThread.access$2100(ActivityThread.java:116)
02-29 19:54:42.323: E/AndroidRuntime(628):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1794)
02-29 19:54:42.323: E/AndroidRuntime(628):  at android.os.Handler.dispatchMessage(Handler.java:99)
02-29 19:54:42.323: E/AndroidRuntime(628):  at android.os.Looper.loop(Looper.java:123)
02-29 19:54:42.323: E/AndroidRuntime(628):  at android.app.ActivityThread.main(ActivityThread.java:4203)
02-29 19:54:42.323: E/AndroidRuntime(628):  at java.lang.reflect.Method.invokeNative(Native Method)
02-29 19:54:42.323: E/AndroidRuntime(628):  at java.lang.reflect.Method.invoke(Method.java:521)
02-29 19:54:42.323: E/AndroidRuntime(628):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:791)
02-29 19:54:42.323: E/AndroidRuntime(628):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:549)
02-29 19:54:42.323: E/AndroidRuntime(628):  at dalvik.system.NativeStart.main(Native Method)
02-29 19:54:42.323: E/AndroidRuntime(628): Caused by: java.lang.NullPointerException
02-29 19:54:42.323: E/AndroidRuntime(628):  at com.remotedata.firstapp.DataconectActivity.onCreate(DataconectActivity.java:54)
02-29 19:54:42.323: E/AndroidRuntime(628):  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1123)
02-29 19:54:42.323: E/AndroidRuntime(628):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2364)
02-29 19:54:42.323: E/AndroidRuntime(628):  ... 11 more
02-29 19:54:42.334: I/dalvikvm(628): threadid=7: reacting to signal 3
02-29 19:54:42.334: E/dalvikvm(628): Unable to open stack trace file '/data/anr/traces.txt': Permission denied
  • 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-30T14:33:40+00:00Added an answer on May 30, 2026 at 2:33 pm

    According to the code you gave, there are only two lines that could produce a NullPointerException.

    Either it because searchopt is null (does R.id.searchtxt belong to you current layout ??)
    Or it is btmsearch that is null (does R.id.searchbtm belong to you current layout ??)

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

Sidebar

Related Questions

Basically, what I'm trying to create is a page of div tags, each has
I am trying to understand how to use SyndicationItem to display feed which is
I'm trying to create an if statement in PHP that prevents a single post
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
I used javascript for loading a picture on my website depending on which small
Seemingly simple, but I cannot find anything relevant on the web. What is the
I have a French site that I want to parse, but am running into
I want use html5's new tag to play a wav file (currently only supported

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.