package irdc.EX04_05;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.TextView;
public class EX04_05 extends Activity 

  private TextView mTextView1;
  private CheckBox mCheckBox1; 
  private CheckBox mCheckBox2;
  private CheckBox mCheckBox3;
  private Button   mButton;
//--------------------------------------------------这段
  public String str1=getString(R.string.str_checkbox1); 
  public String str2=getString(R.string.str_checkbox2); 
  public String str3=getString(R.string.str_checkbox3);
  public String str0="所选的项目为: "  public String plus=";";
  public String result="但是超过预算啰!!"; 
  public String result2="还可以再多买几本喔!!";
//--------------------------------------这段
  @Override 
  public void onCreate(Bundle savedInstanceState)
  {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);     mTextView1 = (TextView) findViewById(R.id.myTextView1);
    mTextView1.setText("你所选择的项目有: ");    mCheckBox1=(CheckBox)findViewById(R.id.myCheckBox1); 
    mCheckBox2=(CheckBox)findViewById(R.id.myCheckBox2); 
    mCheckBox3=(CheckBox)findViewById(R.id.myCheckBox3);
    mButton = (Button)findViewById(R.id.myButton1);
    mCheckBox1.setOnCheckedChangeListener(mCheckBoxChanged); 
    mCheckBox2.setOnCheckedChangeListener(mCheckBoxChanged); 
    mCheckBox3.setOnCheckedChangeListener(mCheckBoxChanged);
   // mButton.setOnClickListener(new Button.OnClickListener(){    }  private CheckBox.OnCheckedChangeListener mCheckBoxChanged = 
    new CheckBox.OnCheckedChangeListener() 
  {     @Override 
    public void onCheckedChanged( 
        CompoundButton buttonView, boolean isChecked) {
      // TODO Auto-generated method stub 
      if(mCheckBox1.isChecked()==true & mCheckBox2.isChecked()==true & mCheckBox3.isChecked()==true) 
      {
        mTextView1.setText(str0+str1+plus+str2+plus+str3+result);
        } 
      else if(mCheckBox1.isChecked()==false & mCheckBox2.isChecked()==true & mCheckBox3.isChecked()==true) 
        {
          mTextView1.setText(str0+str2+plus+str3+result);
          } 
        else if(mCheckBox1.isChecked()==true & mCheckBox2.isChecked()==false & mCheckBox3.isChecked()==true) 
          { 
            mTextView1.setText(str0+str1+plus+str3+result); 
            } 
          else  if(mCheckBox1.isChecked()==true & mCheckBox2.isChecked()==true & mCheckBox3.isChecked()==false) 
            { 
              mTextView1.setText(str0+str1+plus+str2+result); } 
            else if(mCheckBox1.isChecked()==false & mCheckBox2.isChecked()==false & mCheckBox3.isChecked()==true) 
              {
                mTextView1.setText(str0+str3+plus+result2); 
                } 
              else if(mCheckBox1.isChecked()==false & mCheckBox2.isChecked()==true & mCheckBox3.isChecked()==false) 
                { 
                  mTextView1.setText(str0+str2); 
                  } 
                else if(mCheckBox1.isChecked()==true & mCheckBox2.isChecked()==false & mCheckBox3.isChecked()==false) 
                  { mTextView1.setText(str0+str1); } 
                  else if(mCheckBox1.isChecked()==false & mCheckBox2.isChecked()==false & mCheckBox3.isChecked()==false) 
                  { mTextView1.setText(str0); 
                  }
      }
      };
            }
//----这段
xxx
//---这段
这段代码放在这里的时候运行avd的时候会出现崩溃的情况,程序stop了package irdc.EX04_05;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.TextView;
public class EX04_05 extends Activity 

  private TextView mTextView1;
  private CheckBox mCheckBox1; 
  private CheckBox mCheckBox2;
  private CheckBox mCheckBox3;
  private Button   mButton;  @Override 
  public void onCreate(Bundle savedInstanceState)
  {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);     mTextView1 = (TextView) findViewById(R.id.myTextView1);
    mTextView1.setText("你所选择的项目有: ");    mCheckBox1=(CheckBox)findViewById(R.id.myCheckBox1); 
    mCheckBox2=(CheckBox)findViewById(R.id.myCheckBox2); 
    mCheckBox3=(CheckBox)findViewById(R.id.myCheckBox3);
    mButton = (Button)findViewById(R.id.myButton1);
    mCheckBox1.setOnCheckedChangeListener(mCheckBoxChanged); 
    mCheckBox2.setOnCheckedChangeListener(mCheckBoxChanged); 
    mCheckBox3.setOnCheckedChangeListener(mCheckBoxChanged);
   // mButton.setOnClickListener(new Button.OnClickListener(){    }  private CheckBox.OnCheckedChangeListener mCheckBoxChanged = 
    new CheckBox.OnCheckedChangeListener() 
  {     @Override 
    public void onCheckedChanged( 
        CompoundButton buttonView, boolean isChecked) {
      // TODO Auto-generated method stub 
     //--------------------------------------------------这段
  String str1=getString(R.string.str_checkbox1); 
  String str2=getString(R.string.str_checkbox2); 
  String str3=getString(R.string.str_checkbox3);
  String str0="所选的项目为: "  String plus=";";
  String result="但是超过预算啰!!"; 
  String result2="还可以再多买几本喔!!";
//--------------------------------------这段      if(mCheckBox1.isChecked()==true & mCheckBox2.isChecked()==true & mCheckBox3.isChecked()==true) 
      {
        mTextView1.setText(str0+str1+plus+str2+plus+str3+result);
        } 
      else if(mCheckBox1.isChecked()==false & mCheckBox2.isChecked()==true & mCheckBox3.isChecked()==true) 
        {
          mTextView1.setText(str0+str2+plus+str3+result);
          } 
        else if(mCheckBox1.isChecked()==true & mCheckBox2.isChecked()==false & mCheckBox3.isChecked()==true) 
          { 
            mTextView1.setText(str0+str1+plus+str3+result); 
            } 
          else  if(mCheckBox1.isChecked()==true & mCheckBox2.isChecked()==true & mCheckBox3.isChecked()==false) 
            { 
              mTextView1.setText(str0+str1+plus+str2+result); } 
            else if(mCheckBox1.isChecked()==false & mCheckBox2.isChecked()==false & mCheckBox3.isChecked()==true) 
              {
                mTextView1.setText(str0+str3+plus+result2); 
                } 
              else if(mCheckBox1.isChecked()==false & mCheckBox2.isChecked()==true & mCheckBox3.isChecked()==false) 
                { 
                  mTextView1.setText(str0+str2); 
                  } 
                else if(mCheckBox1.isChecked()==true & mCheckBox2.isChecked()==false & mCheckBox3.isChecked()==false) 
                  { mTextView1.setText(str0+str1); } 
                  else if(mCheckBox1.isChecked()==false & mCheckBox2.isChecked()==false & mCheckBox3.isChecked()==false) 
                  { mTextView1.setText(str0); 
                  }
      }
      };
            }//----这段
xxx
//---这段
这段代码放在这里运行avd的时候确实正常的。为什么呢,为什么呢~~
Java

解决方案 »

  1.   

    你贴出来log  就不难改了 上面是大神
      

  2.   

    [2013-04-11 10:18:25 - EX04_05] ------------------------------
    [2013-04-11 10:18:25 - EX04_05] Android Launch!
    [2013-04-11 10:18:25 - EX04_05] adb is running normally.
    [2013-04-11 10:18:25 - EX04_05] Performing irdc.EX04_05.EX04_05 activity launch
    [2013-04-11 10:18:25 - EX04_05] Automatic Target Mode: launching new emulator with compatible AVD 'WQVGA_240'
    [2013-04-11 10:18:25 - EX04_05] Launching a new emulator with Virtual Device 'WQVGA_240'
    [2013-04-11 10:18:30 - EX04_05] New emulator found: emulator-5554
    [2013-04-11 10:18:30 - EX04_05] Waiting for HOME ('android.process.acore') to be launched...
    [2013-04-11 10:19:10 - EX04_05] HOME is up on device 'emulator-5554'
    [2013-04-11 10:19:10 - EX04_05] Uploading EX04_05.apk onto device 'emulator-5554'
    [2013-04-11 10:19:10 - EX04_05] Installing EX04_05.apk...
    [2013-04-11 10:19:40 - EX04_05] Success!
    [2013-04-11 10:19:40 - EX04_05] Starting activity irdc.EX04_05.EX04_05 on device emulator-5554
    [2013-04-11 10:19:41 - EX04_05] ActivityManager: Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=irdc.EX04_05/.EX04_05 }这是日志信息,好像在虚拟机那里也生产不了exe呢。是一个配置图表,点击打开的时候提示程度停止
      

  3.   

    这个是控制台的信息,要看LogCat的信息
      

  4.   

    04-11 03:32:41.589: E/StrictMode(649): android.app.ServiceConnectionLeaked: Service com.android.exchange.ExchangeService has leaked ServiceConnection com.android.emailcommon.service.ServiceProxy$ProxyConnection@40cee8f8 that was originally bound here
    04-11 03:32:41.589: E/StrictMode(649):  at android.app.LoadedApk$ServiceDispatcher.<init>(LoadedApk.java:969)
    04-11 03:32:41.589: E/StrictMode(649):  at android.app.LoadedApk.getServiceDispatcher(LoadedApk.java:863)
    04-11 03:32:41.589: E/StrictMode(649):  at android.app.ContextImpl.bindService(ContextImpl.java:1418)
    04-11 03:32:41.589: E/StrictMode(649):  at android.app.ContextImpl.bindService(ContextImpl.java:1407)
    04-11 03:32:41.589: E/StrictMode(649):  at android.content.ContextWrapper.bindService(ContextWrapper.java:473)
    04-11 03:32:41.589: E/StrictMode(649):  at com.android.emailcommon.service.ServiceProxy.setTask(ServiceProxy.java:157)
    04-11 03:32:41.589: E/StrictMode(649):  at com.android.emailcommon.service.ServiceProxy.setTask(ServiceProxy.java:145)
    04-11 03:32:41.589: E/StrictMode(649):  at com.android.emailcommon.service.ServiceProxy.test(ServiceProxy.java:191)
    04-11 03:32:41.589: E/StrictMode(649):  at com.android.exchange.ExchangeService$7.run(ExchangeService.java:1850)
    04-11 03:32:41.589: E/StrictMode(649):  at com.android.emailcommon.utility.Utility$2.doInBackground(Utility.java:551)
    04-11 03:32:41.589: E/StrictMode(649):  at com.android.emailcommon.utility.Utility$2.doInBackground(Utility.java:549)
    04-11 03:32:41.589: E/StrictMode(649):  at android.os.AsyncTask$2.call(AsyncTask.java:287)
    04-11 03:32:41.589: E/StrictMode(649):  at java.util.concurrent.FutureTask.run(FutureTask.java:234)
    04-11 03:32:41.589: E/StrictMode(649):  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
    04-11 03:32:41.589: E/StrictMode(649):  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
    04-11 03:32:41.589: E/StrictMode(649):  at java.lang.Thread.run(Thread.java:856)
    04-11 03:32:41.589: W/ActivityManager(278): Unbind failed: could not find connection for android.os.BinderProxy@40f93698
    04-11 03:32:41.619: D/dalvikvm(649): GC_CONCURRENT freed 459K, 20% free 2458K/3060K, paused 79ms+4ms, total 160ms