mehdi.safavie
دوشنبه 20 مهر 1394, 09:03 صبح
@Override
public void onClick(View v) {
String data = null,new_item= null, text_message = "2.1,2.3,2.2";
//Change codesms to textsms
data = text_message;
text_message = null;
for (int x=0 ; x < data.length() - 1 ; x += 4)
{
new_item = data.substring(x, 3);
if (new_item.contains("2.1"))
{
text_message += "a";
}
if (new_item.contains("2.2"))
{
text_message += "b";
}
}
//end change
Toast toster = Toast.makeText(this,tost,Toast.LENGTH_LONG);
toster.show();
}
در ضمن یه مشکل دیگه هم دارم
از تابع switch استفاده کردم ولی به مقدار داخل پرانتز switch گیر میده ! چرا ؟
switch ("String variable")
{
case "mytext1":
break;
case "mytext2":
break;
}
پیغام خطاش هم اینه :
Error:(93, 25) error: strings in switch are not supported in -source 1.6
(use -source 7 or higher to enable strings in switch)
public void onClick(View v) {
String data = null,new_item= null, text_message = "2.1,2.3,2.2";
//Change codesms to textsms
data = text_message;
text_message = null;
for (int x=0 ; x < data.length() - 1 ; x += 4)
{
new_item = data.substring(x, 3);
if (new_item.contains("2.1"))
{
text_message += "a";
}
if (new_item.contains("2.2"))
{
text_message += "b";
}
}
//end change
Toast toster = Toast.makeText(this,tost,Toast.LENGTH_LONG);
toster.show();
}
در ضمن یه مشکل دیگه هم دارم
از تابع switch استفاده کردم ولی به مقدار داخل پرانتز switch گیر میده ! چرا ؟
switch ("String variable")
{
case "mytext1":
break;
case "mytext2":
break;
}
پیغام خطاش هم اینه :
Error:(93, 25) error: strings in switch are not supported in -source 1.6
(use -source 7 or higher to enable strings in switch)