私は何十種類もの組み合わせを試しましたが、なぜこれがうまくいかないのかわかりません。バンドルからローカル値への文字列の比較
私はスピナーの値を文字列に保存した以前のアクティビティからバンドルを渡しています。私はその文字列を読んでいて、それが私が指定したものと同等であれば、そのことを実行します。
文字列をTextViewに直接印刷して、期待通りの結果が得られていることを確認しましたが、それでも登録されません。
TextView tv;
Bundle extras = getIntent().getExtras();
tv = (TextView) findViewById(R.id.textView2);
tv.append(extras.getString("pageNumber"));
tv = (TextView) findViewById(R.id.textView3);
int base = Integer.parseInt(extras.getString("pageNumber")) * 70;
tv.append(Integer.toString(base));
/* Here is where I'm editing */
tv = (TextView) findViewById(R.id.textView4);
String plat = extras.getString("platform");
if (plat == "Wordpress") tv.append("900");
スピナーのための私の配列が、私のstrings.xmlで定義され、以下のようになっている。
<string-array name="platform_array">
<item>None</item>
<item>Joomla</item>
<item>Wordpress</item>
<item>Drupal</item>
</string-array>
Hm、Java固有の構文でなければならない - 私はC++に慣れている。ありがとう! –