时间:2021-05-20
复制代码 代码如下:
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);
}
}
声明:本页内容来源网络,仅供用户参考;我单位不保证亦不表示资料全面及准确无误,也不保证亦不表示这些资料为最新信息,如因任何原因,本网内容或者用户因倚赖本网内容造成任何损失或损害,我单位将不会负任何法律责任。如涉及版权问题,请提交至online#300.cn邮箱联系删除。
Android捕获运行时异常详解Android异常分为两类:CheckedException和UnCheckedExceptionCheckException:
详解Java中多线程异常捕获Runnable的实现1、背景:Java多线程异常不向主线程抛,自己处理,外部捕获不了异常。所以要实现主线程对子线程异常的捕获。2、
问题怎样捕获代码中的所有异常?解决方案想要捕获所有的异常,可以直接捕获Exception即可:try:...exceptExceptionase:...log(
异常处理机制1、抛出异常2、捕获异常3、异常处理五个关键字:try、catch、finally、throw、throws注意:假设要捕获多个异常:需要按照层级关
eclipse想要捕获异常处理异常信息,该怎么使用快捷键处理异常呢?下面我们就来看看详细的教程。软件名称:eclipse20204.15汉化包官方免费版(附安装