intent.putExtra("One", FactorOneStr);
intent.putExtra("Two", FctorTwoStr);

解决方案 »

  1.   

    在AndroidManifest.xml中加了上面的Activity了吗?<activity android:name="AutoSelect"></activity>
    <activity android:name="Activity03"></activity>
      

  2.   

    intent.putExtra("One", FactorOneStr);
    intent.putExtra("Two", FctorTwoStr);这里改好了。在AndroidManifest.xml中我也添加了。代码如下:<?xml version="1.0" encoding="utf-8"?>
    <manifest xmlns:android="http://schemas.android.com/apk/res/android"
          package="com.activity"
          android:versionCode="1"
          android:versionName="1.0">
          <uses-sdk android:minSdkVersion="3"></uses-sdk>
        <application android:icon="@drawable/icon" android:label="@string/app_name">
            <activity android:name=".Activity03"
                      android:label="@string/app_name">
                <intent-filter>
                    <action android:name="android.intent.action.MAIN" />
                    <category android:name="android.intent.category.LAUNCHER" />
                </intent-filter>
            </activity>
            <activity android:name=".OtherActivity" android:label="@string/Result" />    </application>
    </manifest> 
    但是运行后还是出现上面所说的问题啊!还没解决!
      

  3.   

    12-26 07:23:32.152: ERROR/AndroidRuntime(343): Caused by: java.lang.NumberFormatException: unable to parse 'FactorOneStr' as integer
      

  4.   

    把Activity03内代码改下
     
      EditText et1 = (EditText)findViewById(R.id.myFactorOne);
      
      EditText et2 = (EditText)findViewById(R.id.myFactorTwo);
      intent.putExtra("One",  Integer.parseInt(et1.getText().toString().trim()));
      intent.putExtra("Two", Integer.parseInt(et2.getText().toString().trim()));
      intent.setClass(Activity03.this, OtherActivity.class);
      Activity03.this.startActivity(intent);OtherActivity改成这样
    ResultView = (TextView) findViewById(R.id.Result);
    Intent intent = getIntent();
    int FactorOneStr =intent.getIntExtra("One", 0);
    int FactorTwoStr =intent.getIntExtra("Two", 0);
    int result = FactorOneStr * FactorTwoStr;
    ResultView.setText(result + " ");
      

  5.   

      看了一下午,原来是我这段代码些错了,应把下列代码改为:
      String FactorOneStr=getText(R.id.myFactorOne).toString();
      String FactorTwoStr=getText(R.id.myFactorTwo).toString();
      intent.putExtra("One", "FactorOneStr");
      intent.putExtra("Two", "FctorTwoStr");改为:
    String FactorOneStr=myFactorOne.getText().toString();
      String FactorTwoStr=myFactorTwo.getText().toString();
      intent.putExtra("One", FactorOneStr);
      intent.putExtra("Two", FctorTwoStr);
    不过还是应该谢谢大家!