Example of the Hockeyapp capture exception for the Android tutorial _android

Source: Internet
Author: User
Tags hockeyapp

Copy Code code as follows:

Package Com.example.testhockeyapp;
Import Net.hockeyapp.android.CrashManager;
Import Net.hockeyapp.android.CrashManagerListener;
Import Net.hockeyapp.android.UpdateManager;
Import Android.os.Bundle;
Import android.app.Activity;
Import Android.view.Menu;
Import Android.view.View;
Import Android.view.View.OnClickListener;
Import Android.widget.Button;
Import Android.widget.Toast;

public class Mainactivity extends activity {

private static final String app_id = "A7ab0fe5f11edc8afbfbc842ecc38ad7";

String a = null;

@Override
protected void OnCreate (Bundle savedinstancestate) {
Super.oncreate (savedinstancestate);
Setcontentview (R.layout.activity_main);
Button button = (button) Findviewbyid (R.id.button1);
Button.setonclicklistener (New Onclicklistener () {

@Override
public void OnClick (View v) {
A.charat (23);

}
});
Checkforupdates ();
}

@Override
public boolean Oncreateoptionsmenu (Menu menu) {
Inflate the menu; This adds items to the action bar if it is present.
Getmenuinflater (). Inflate (R.menu.main, menu);
return true;
}

@Override
protected void Onresume () {
TODO auto-generated Method Stub
Super.onresume ();

Checkforcrashes ();
}
private void Checkforcrashes () {
Crashmanager.register (This, app_id, new Crashmanagerlistener () {
@Override
public void Oncrashessent () {
Super.oncrashessent ();
Runonuithread (New Runnable () {

@Override
public void Run () {
Toast.maketext (Getapplicationcontext (),
"Crash data was sent. Thanks! ",
Toast.length_long). Show ();
}
});
}

@Override
public void Oncrashesnotsent () {
Super.oncrashesnotsent ();
Runonuithread (New Runnable () {

@Override
public void Run () {
Toast.maketext (
Getapplicationcontext (),
"Crash data failed to sent. Please try again later. ",
Toast.length_long). Show ();
}
});
}
});
}
private void Checkforupdates () {
Remove this for store builds!
Updatemanager.register (this, app_id);
}
}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.