我试图表明举杯当两个EditText
或一个主题的是EMPTY
防止应用程序从崩溃因的传递一个空值到下一个活动在Button
>>检查EditText的内容?
这里,当点击是我的方法(巴顿的方法):
public void mods(View view) {
dNewBuy = Double.parseDouble(newBuy.getText().toString());
dNewSell = Double.parseDouble(newSell.getText().toString());
String BuyVal = newBuy.getText().toString();
String SellVal = newSell.getText().toString();
if((BuyVal.isEmpty()) || (SellVal.isEmpty())) {
Toast.makeText(this, "ZERO", Toast.LENGTH_SHORT).show();
} else {
Intent intent = new Intent(Values.this, calculator.class);
Bundle b = new Bundle();
b.putDouble("valueSell", dNewSell);
b.putDouble("valueBuy", dNewBuy);
b.putString("flag", flag);
intent.putExtras(b);
startActivity(intent);
}
newSell
和newBuy
两个EditTexts
..
的} else {}
部分工作正常:/
,但是,它给了我这个当值为空..
java.lang.IllegalStateException: Could not execute method of the activity
清单::
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".calculator" />
<activity android:name=".About" />
<activity android:name=".Values"
android:theme="@android:style/Theme.Holo.Light.Dialog.NoActionBar">
</activity>
</application>
请向我们显示您的清单。 –
@PedroOliveira完成 –
请提供完整的堆栈跟踪。似乎还有另一个错误,您可能会从日志中错过它。 –