English 中文(简体)
模拟被拒绝的呼唤和机器人的冰冷
原标题:emulating rejected call android-eclipse indigo

我的应用程序调用一个保存的号码, 此号码必然拒绝调用 。 我如何模拟模拟模拟在模拟器中被拒绝的外出调用? 我使用日蚀 Indigo IDE 。 所有动作都是完全程序驱动的 。 一旦调用被拒绝, 有些程序必须运行 。

问题回答

您可以使用 2 个模拟器, 拨其中一个的端口号( 即 5556 ), 在此模拟器中拒绝调用, 并在调用模拟器上结束 。

You can use the DDMS perspective for achieving this. Goto DDMS -> Emulator control -> Enter the incoming number you have already saved in the emulator and make a call.

public class PhoneStateListenerActivity extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
    PhoneStateListener listener;
    TelephonyManager manager;

    manager = (TelephonyManager) getSystemService(TELEPHONY_SERVICE);
    listener = new PhoneStateListener(){
        public void onCallStateChanged(int state, String incomingNumber) {
            String stateString = "N/A";
            switch (state) {
            case TelephonyManager.CALL_STATE_IDLE:
              stateString = "Idle";
              break;
            case TelephonyManager.CALL_STATE_OFFHOOK:
              stateString = "Off Hook";
              break;
            case TelephonyManager.CALL_STATE_RINGING:
              stateString = "Ringing";
              break;
            时 时
            Toast.makeText(PhoneStateListenerActivity.this, stateString, Toast.LENGTH_SHORT)
            .show();
        时 时           
    时 时;

    manager.listen(listener, PhoneStateListener.LISTEN_CALL_STATE);
时 时

时 时





相关问题
In Eclipse, why doesn t "Show In" appear for non-Java files?

If I have a *java file open, I can right click on the source, scroll down to "Show In (Alt-Shift-W)", and select Navigator. If I have an *xml, *jsp, or pretty much anything besides a Java source ...

Eclipse: Hover broken in debug perspective

Since upgrading Eclipse (Galileo build 20090920-1017), hover in debug no longer displays a variable s value. Instead, hover behaves as if I were in normal Java perspective: alt text http://...

Eclipse smart quotes - like in Textmate

Happy Friday — Does anyone know if eclipse has the notion of smart quotes like Textmate. The way it works is to select some words and quote them by simply hitting the " key? I m a newbie here so be ...

Indentation guide for the eclipse editor

Is there a setting or plugin for eclipse that can show indentation guides in the editor? Something like the Codekana plugin for visual studio (not so fancy is also OK). Important that it works with ...

Adding jar from Eclipse plugin runtime tab

I want to add .jar files for plugin from the Runtime tab of manifest file. When I use the Add... button, I can see only sub-directories of the plugin project. So if I want to add same .jar file to ...

How to copy multiple projects into single folder in eclipse

I have two projects, Project1 and Project2. Now i want to copy this projects into eclipse workspace but i want these projects to be in a single folder like below. Eclipse Workspace -> Project -> ...

Java: Finding out what is using all the memory

I have a java application that runs out of memory, but I have no idea which code is allocating the memory. Is there an application with which I can check this? I use Eclipse.

热门标签