0

我有一个 android 应用程序在一段时间后突然关闭。当我打电话给某人并再次尝试时,断开连接时我的应用程序崩溃了。有人可以帮我吗?

private void call() {
    try {
        EditText ed = (EditText) findViewById(R.id.txtcall);
        DeleteCallLogByNumber(ed.getText().toString());

        if (!stopcall) {
            phoneInfo = new OutgoingCallReceiver();
            registerReceiver(phoneInfo, new IntentFilter(Intent.ACTION_NEW_OUTGOING_CALL));
        }
        //EditText ed=(EditText) findViewById(R.id.txtcall);        

        Uri uri = Uri.fromParts("tel", ed.getText().toString(), null);
        callIntent = new Intent(Intent.ACTION_CALL, uri);
        //callIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
        callIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        startActivity(callIntent);

        try {
            mc.cancel();
        } catch (Exception e) {
            //Log.e("Exception found ",e.getMessage()); 
        }
        mc = new MyCounter(1000 * Integer.parseInt(tvtime.getText().toString()), 1000);
        mc.start();
    } catch (Exception e) {
        Toast.makeText(getApplicationContext(), String.valueOf("phone number "),
                Toast.LENGTH_SHORT).show();
        //Log.e("Exception found ",e.getMessage());

}

我的清单文件:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="Call.packages"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk android:minSdkVersion="7" />
  <uses-permission android:name="android.permission.CALL_PHONE"/>
    <uses-permission android:name="android.permission.READ_PHONE_STATE"/>
    <uses-permission android:name="android.permission.PROCESS_OUTGOING_CALLS"/>
        <uses-permission android:name="android.permission.READ_CALL_LOG" />
        <uses-permission android:name="android.permission.WRITE_CALL_LOG" />
    <uses-permission android:name="android.permission.READ_CONTACTS" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" />

    <uses-permission android:name="android.permission.READ_CONTACTS" /> 
<uses-permission android:name="android.permission.WRITE_CONTACTS" />

    <application
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name" 
        android:persistent="true">
        <activity
            android:label="@string/app_name"
            android:name=".CallActivity" >
            <intent-filter >
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />

            </intent-filter>
    <receiver android:name=".receiver.OutgoingCallReceiver" android:enabled="true">
        <intent-filter android:priority="35345">
              <action android:name="android.intent.action.ACTION_PHONE_STATE_CHANGED" />
                <action android:name="android.intent.action.NEW_OUTGOING_CALL" />
                <action android:name="android.net.conn.CONNECTIVITY_CHANGE" />
                <action android:name="android.intent.action.ANSWER" />
                <action android:name="android.intent.action.PHONE_STATE" />
                <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>
    </receiver>
    <receiver android:process=":remote"  android:name="AlarmReceiver"></receiver>
        </activity>
         <activity android:name=".AboutActivity" android:label="@string/app_name">
         </activity>
    </application>

</manifest>
4

0 回答 0