Android 每个进程多次调用隐藏构造函数

Android 每个进程多次调用隐藏构造函数,android,Android,我在日志中发现了这个错误 TelephonyManager : Hidden constructor called more than once per process! 我的电话听筒坏了 @Override public void onCallStateChanged(int state, String incomingNumber) { switch (state) { case Teleph

我在日志中发现了这个错误

TelephonyManager : Hidden constructor called more than once per process!
我的电话听筒坏了

@Override
public void onCallStateChanged(int state, String incomingNumber) {

                        switch (state) {
                        case TelephonyManager.CALL_STATE_IDLE:
                            Log.e("state", "idle");
                            break;
                        case TelephonyManager.DATA_CONNECTED:
                            Log.e("state", "connected");
                            break;
                        }
                    };
                };

    telManager = (TelephonyManager) context
            .getSystemService(Context.TELEPHONY_SERVICE);
    telManager.listen(callListener, PhoneStateListener.LISTEN_CALL_STATE);

它不会打印出我的日志

从源代码中我得到了以下信息:

/**提供对设备上电话服务信息的访问。应用程序可以使用此类中的方法来确定电话服务和状态,以及访问某些类型的订户信息。应用程序还可以注册侦听器以接收电话状态更改的通知

您不直接实例化这个类;相反,您可以通过{@link android.content.ContextgetSystemService Context.getSystemServiceContext.TELEPHONY_SERVICE}检索对实例的引用*

请注意,对某些电话信息的访问受权限保护。除非您的应用程序在其清单文件中声明了相应的权限,否则无法访问受保护的*信息。如果应用了权限,则会在访问受保护信息的方法中注明这些权限**/

public class TelephonyManager {

private static final String TAG = "TelephonyManager";

private static Context sContext;
private static ITelephonyRegistry sRegistry;

/** @hide */
public TelephonyManager(Context context) {
    context = context.getApplicationContext();
    if (sContext == null) {
        sContext = context;

        sRegistry = ITelephonyRegistry.Stub.asInterface(ServiceManager.getService(
                "telephony.registry"));
    } else if (sContext != context) {
        Log.e(TAG, "Hidden constructor called more than once per process!");
        Log.e(TAG, "Original: " + sContext.getPackageName() + ", new: " +
                context.getPackageName());
    }
}

您是否正在从不同的上下文创建多个TelephonyManager实例?如果是这样的话,那么错误日志将显示为静态上下文。

至少列举一下你从哪里得到答案的,伙计。这是原始资料来源,