进程在android中不显示

进程在android中不显示,android,Android,我有一个我写的应用程序,它是下面的包“com.pack”。当我启动应用程序时,我在DDMS中没有看到设备中显示的进程列表中的“com.pack”。这怎么可能有人知道为什么吗?下面是代码和xml清单文件 package com.pack; import java.util.List; import java.util.Timer; import java.util.TimerTask; import android.app.Activity; import android.content.C

我有一个我写的应用程序,它是下面的包“com.pack”。当我启动应用程序时,我在DDMS中没有看到设备中显示的进程列表中的“com.pack”。这怎么可能有人知道为什么吗?下面是代码和xml清单文件

package com.pack;

import java.util.List;

import java.util.Timer;
import java.util.TimerTask;

import android.app.Activity;
import android.content.ComponentName;
import android.content.Intent;
import android.content.pm.ActivityInfo;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.graphics.PorterDuff.Mode;
import android.net.Uri;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.text.format.Time;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;

import com.android.internal.telephony.CallManager;
import com.android.internal.telephony.Phone;
import com.android.internal.telephony.Call;
import com.android.internal.telephony.PhoneFactory;

public class AutoVT extends Activity {

    public static final int MAKE_CALL           = 1;

    public static final int END_CALL            = 2;

    public static final int PHONE_STATE_CHANGED = 101;

    //CallManager mCM;

    Button callButton ;

    ActivityInfo info =null; 

    ComponentName component ;

    String callperiod_text;

    String waitperiod_text;

    String number;

    public int callPeriod=0;

    public int waitPeriod = 0;

    @Override
    public void onCreate(Bundle savedInstanceState) {

        Log.i("AutoVT","starting AutoVT");

        //registerForPhoneStates();

        super.onCreate( savedInstanceState );

        setContentView( R.layout.main );

        callButton = (Button)findViewById(R.id.callButton);

        callButton.getBackground().setColorFilter(0xFFFF0000,Mode.MULTIPLY);

        callButton.setOnClickListener(new OnClickListener() {

            public void onClick(View v) {

                callperiod_text   =  ( ( ( EditText )findViewById( R.id.call_period )).getText()).toString();

                waitperiod_text   =  ( ( ( EditText )findViewById( R.id.wait_period )).getText() ).toString();

                number =  ( ( ( EditText )findViewById( R.id.PhoneNumber )).getText() ).toString();

                if( !callperiod_text.equals("")&& !waitperiod_text.equals("") && ! number.equals("")) {

                    callPeriod = (Integer.valueOf( callperiod_text ))*1000;

                    waitPeriod = (Integer.valueOf( waitperiod_text ))*1000;

                    phoneHandler.sendEmptyMessage(MAKE_CALL);


                }

            }

        });

    }

    private Handler phoneHandler = new Handler() {

        public void handleMessage(Message msg) {

            Log.i("AutoVT received some message:", msg.toString());

            switch(msg.what) {

                case PHONE_STATE_CHANGED: {

                    Log.i("AutoVT","Phone State Changed");

                    Log.i("AutoVT", mCM.getActiveFgCallState() );

                    if( mCM.getActiveFgCallState() == Call.State.ACTIVE ) {

                        Log.i("AutoVT","Call ACTIVE");

                        final Timer timer = new Timer();

                        Log.i("AutoVT","Active timer started");

                        timer.scheduleAtFixedRate( new TimerTask() {

                            int count = 0;

                            public void run() {

                                if( count++ >=1) {

                                    timer.cancel();

                                    runOnUiThread(new Runnable() {

                                        @Override
                                        public void run() {

                                            phoneHandler.sendEmptyMessage(END_CALL);

                                        }
                                    });

                                }                               
                            }
                        }, 0, callPeriod );

                    } else if( mCM.getActiveFgCallState() == Call.State.DISCONNECTED ) {

                        Log.i("AutoVT","Call DISCONNECTED");

                        final Timer timer =new Timer();

                        Log.i("AutoVT","Waiting timer started");

                        timer.scheduleAtFixedRate( new TimerTask() {

                            int count = 0;

                            public void run() {

                                if( count++ >=1) {

                                    timer.cancel();

                                    runOnUiThread(new Runnable() {

                                        @Override
                                        public void run() {

                                            phoneHandler.sendEmptyMessage(MAKE_CALL);

                                        }
                                    });

                                }                               
                            }
                        }, 0, waitPeriod );


                    }

                    break;

                }

                case MAKE_CALL : {

                    Log.i("AutoVT","In the case MAKE_CALL");

                    Intent callIntent = new Intent(Intent.ACTION_CALL_PRIVILEGED,Uri.fromParts("tel", number,null));

                    callIntent.putExtra("videocall", true);

                    callIntent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP| Intent.FLAG_ACTIVITY_NEW_TASK);

                    getApplicationContext().startActivity(callIntent);

                    break;
                }

                case END_CALL :{

                    Log.i("AutoVT","In the case END_CALL");

                    Intent callEndIntent = new Intent();

                    callEndIntent.setAction("com.android.phone.END");

                    sendBroadcast(callEndIntent);

                    break;
                }

            }

        }

    };

}
XML清单

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


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

    </application>
</manifest>


它没有处理日志转到Windows>>显示视图>>其他>>单击日志并运行您的项目,以便显示

并且还使用

 System.out.println(); 
用于在logcate中生成消息

  • 转到您的
    android sdk/tools
    目录
  • 如果您使用的是linux
    /adb shell
    为您工作,请使用adb shell
  • 消防命令
    dumpsys活动
  • 如果你想从eclipdse那里得到它

     DDMS -> Devices -> select your device or Emulator -> look at that window you have find
     your current running process's package name.
    

    谢谢。

    未处理其日志转到Windows>>显示视图>>其他>>单击日志并运行您的项目,以便显示