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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 19, 20262026-06-19T00:19:04+00:00 2026-06-19T00:19:04+00:00

Application crashes and I’m getting this error : 02-19 13:48:34.168: E/AndroidRuntime(1070): FATAL EXCEPTION: main

  • 0

Application crashes and I’m getting this error :

02-19 13:48:34.168: E/AndroidRuntime(1070): FATAL EXCEPTION: main
02-19 13:48:34.168: E/AndroidRuntime(1070): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.prva/com.example.prva.MainMenu}: java.lang.NullPointerException

02-19 13:48:34.168: E/AndroidRuntime(1070): Caused by: java.lang.NullPointerException
02-19 13:48:34.168: E/AndroidRuntime(1070):     at com.example.prva.MainMenu.onCreate(MainMenu.java:49)

When I try to runs this activity :

public class MainMenu extends Activity{ 
    Calendar c = Calendar.getInstance();    
    int currentsecond = c.get(Calendar.SECOND); 
    Handler h=new Handler();
    DatabaseManager db;



    @Override
    protected void onCreate(Bundle savedInstanceState) {
        // TODO Auto-generated method stub
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);             
        h.post(new Runnable(){
            @Override
            public void run() {             
                String currentDateTimeString = new SimpleDateFormat("dd.MM.yyyy HH:mm").format(new Date());
                TextView text = (TextView) findViewById(R.id.txtDate);
                text.setText(currentDateTimeString);
                h.postDelayed(this, 60000);
            }
        });

        db = new DatabaseManager(this);             


        Button btnalarm = (Button) findViewById(R.id.btnSetAlarm);
        btnalarm.setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View v) {
                // TODO Auto-generated method stub      
                startActivity(new Intent(MainMenu.this, SetAlarm.class));               
            }           
        });

        Button btnmelody = (Button)findViewById(R.id.btnSetMelody);
        btnmelody.setOnClickListener(new OnClickListener() {

            @Override
            public void onClick(View v) {
                // TODO Auto-generated method stub
                startActivity(new Intent(MainMenu.this, SetMelody.class));
            }
        });     

        Button btnlist = (Button) findViewById(R.id.btnAlarmList);
        btnlist.setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View arg0) {
                // TODO Auto-generated method stub
                Intent intent1 = new Intent(MainMenu.this, AlarmList.class);
                startActivity(intent1);
            }
        });

        Button btndata = (Button) findViewById(R.id.btnDatabase);
        btndata.setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View arg0) {
                // TODO Auto-generated method stub
                Intent intent2 = new Intent(MainMenu.this, ManageDatabase.class);
                startActivity(intent2);
            }
        }); 
    }
}

Line 49 is :

btnalarm.setOnClickListener(new View.OnClickListener() {
  • 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-19T00:19:05+00:00Added an answer on June 19, 2026 at 12:19 am

    Your problem should be when you try to findViewById for your Button, take a look if this id (R.id.btnSetAlarm) is same in your layout or if this button is there in the setContentView(R.layout.activity_main);

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

Sidebar

Related Questions

My application crashes when i put background line like in this code. When i
I have found that my application crashes with a null reference exception right here
If my application crashes, a Microsoft Visual C++ Runtime Library Runtime Error! occurs. The
When my Visual Studio 2008 C++ command-line application crashes, it sometimes produces this dialog.
My application crashes on this line [NSThread detachNewThreadSelector: @selector(getJSON:) toTarget:self withObject:nil]; Here is how
I seem to be getting application crashes at: parent.findViewById(R.id.a_1).setVisibility(View.VISIBLE); not sure what im doing
I am learning GTK+ and this simple application crashes every time I run it.
I've been trying to fix this crash for almost a week. The application crashes
When I start the application crashes following error /home/stereodenis/.rvm/gems/ruby-1.9.3-p194@nyanya/gems/haml-3.1.6/lib/haml/helpers/action_view_mods.rb:15:in `alias_method': undefined method `render' for
I've found several C# application crashes in response to error conditions such as obj

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.