文字列の比較に問題があります。string.xml で「activation」の文字列値を取得します。同じ値を持つ文字列値と比較すると、結果は常にfalseです(string.xmlのアクティベーション=テストで)
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">MyNameApp</string>
<string name="activation">test</string>
</resources>
public class CheckGenuine {
public static String cod;
public static String app;
public static Boolean chk(Context ctx) {
Boolean ret;
cod = ctx.getString(R.string.activation);
app = ctx.getString(R.string.app_name);
if (cod == "test") {
Toast.makeText(ctx, "True cod = " + cod, Toast.LENGTH_LONG).show();
ret = true;}
else {
Toast.makeText(ctx, "False cod = " + cod, Toast.LENGTH_LONG).show();
ret = false;}
// *** why ret is always false and Toast shows "False cod = test" ????????????????
return ret;
}
}