I would like to implement my StringStack in a switch statement how can i make this work in java. it sais i cant push() and argument with a char value. What is the best way around this for my validation method?
package xmlvalidator;
public class BasicXmlValidator implements XmlValidator {
#Override
public String[] validate(String xmlDocument) {
// TODO Auto-generated method stub
int charIndex = 0;
char currentCharacter;
String characterString;
while (charIndex < xmlDocument.length()) {
currentCharacter = xmlDocument.charAt(charIndex);
characterString = Character.toString(currentCharacter);
switch (currentCharacter) {
case '(': StringStack.push(currentCharacter);
break;
case '[': StringStack.push(currentCharacter);
break;
case '{': StringStack.push(currentCharacter);
break;
case ')': StringStack.push(currentCharacter);
break;
case ']': StringStack.push(currentCharacter);
break;
case '}': StringStack.push(currentCharacter);
break;
}
}
return null;
}
}
package xmlvalidator;
import static java.lang.System.*;
public class BasicStringStack implements StringStack {
public int count; // Number of Items in the array
public String[] stackItems; // The array that holds the stack items
public BasicStringStack(int initialSize) {
count = 0;
stackItems = new String[initialSize];
}
#Override
public void push(String item) {
// TODO Auto-generated method stub
if (count == stackItems.length) {
int newLength = (stackItems.length + 1);
String[] tempArray = new String[newLength];
arraycopy(stackItems, 0, tempArray, 0, stackItems.length);
stackItems = tempArray;
}
stackItems[count++] = item;
}
#Override
public String pop() {
if (count == 0) {
return null;
} else {
return stackItems[--count];
}
}
#Override
public String peek(int position) {
if ((position > count - 1) || (position < 0)) {
return null; // outside Bounds
} else {
return stackItems[count - position - 1];
}
}
#Override
public int getCount() {
// TODO Auto-generated method stub
return count;
}
}
You have the current char stored in a string using characterString = Character.toString(currentCharacter); just use it to push into stack.
StringStack.push(currentCharacter);
change to
StringStack.push(currentString);
Your problem is exactly as Java describes it to you. You pass a char to a method that expects String. The best fix would be
Stringstack.push(characterString);
Aside: because switch lets you fall through, you can rewrite it as
switch (currentCharacter) {
case '(':
case '[':
case '{':
case ')':
case ']':
case '}':
StringStack.push(characterString);
break;
}
Further aside: I did not address other potential problems in the code, but sought only to address the question asked.
Related
I'm Mikamocha, and I just started programming Android apps. I have problems in my first calculator app (the results). What I mean is so that 2+2 will be 4 instead of 4.0, 5-2 will be 3 instead of 3.0, etc.
package com.yeshua.mikamocha.myxcalculator;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
public class MainActivity extends AppCompatActivity {
private EditText Scr;
private float NumberBf=0, NumAf, result=0;
private String Operation, mod="replace";
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Scr = (EditText) findViewById(R.id.txtScreen);
Scr.setText("");
int idList[] = {R.id.btn0, R.id.btn1, R.id.btn2, R.id.btn2, R.id.btn3, R.id.btn4,
R.id.btn5, R.id.btn6, R.id.btn7, R.id.btn8, R.id.btn9,
R.id.btnAdd, R.id.btnSubtract, R.id.btnMultiply, R.id.btnDivide,
R.id.btnClear,R.id.btnEquals, R.id.btnDot, };
for(int id:idList) {
View v = (View) findViewById(id);
v.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {
onButtonClick(v);
}
});
}
}
public void mMath(String str) {
mResult();
try {
NumberBf = Float.parseFloat(Scr.getText().toString());
Operation = str;
}catch (Exception e) {
Toast.makeText(getApplicationContext(), (CharSequence) e, Toast.LENGTH_SHORT).show();
Scr.setText("SYNTAX ERROR");
mod = "replace";
}
}
public void mResult() {
NumAf = 0;
if(!Scr.getText().toString().trim().isEmpty())
NumAf = Float.parseFloat(Scr.getText().toString());
result = NumAf;
try {
switch (Operation) {
case "+":
result = NumAf + NumberBf;
break;
case "-":
result = NumberBf - NumAf;
break;
case "*":
result = NumAf * NumberBf;
break;
case "/":
result = NumberBf / NumAf;
break;
default:
result = NumAf;
break;
}
} catch (Exception e) {
e.printStackTrace();
}
Scr.setText(String.valueOf(result));
mod = "replace";
}
public void getKeyboard(String str) {
String ScrTxt = Scr.getText().toString();
ScrTxt += str;
if(mod.equals("add"))
Scr.setText(ScrTxt);
else
Scr.setText(str);
mod = "add";
}
public void onButtonClick(View v) {
switch (v.getId()) {
case R.id.btnClear: //Clear
Scr.setText("");
NumberBf = 0;
Operation = "";
break;case R.id.btnAdd:
mMath("+");
break;
case R.id.btnSubtract:
if(mod.equals("replace")) {
String numb = ((Button) v).getText().toString();
getKeyboard(numb);
}
else mMath("-");
break;
case R.id.btnMultiply:
mMath("*");
break;
case R.id.btnDivide:
mMath("/");
break;
case R.id.btnEquals:
mResult();
Operation = "";
NumberBf = 0;
break;
default:
String numb = ((Button) v).getText().toString();
getKeyboard(numb);
break;
}
}
}
Thanks.
You should use NumberFormat.
For example:
public static void main(String[] args) {
System.out.println(format(14.0184849945)); // prints '14.01'
System.out.println(format(13)); // prints '13'
System.out.println(format(3.5)); // prints '3.5'
System.out.println(format(3.138136)); // prints '3.13'
}
public static String format(Number n) {
NumberFormat format = DecimalFormat.getInstance();
format.setRoundingMode(RoundingMode.FLOOR);
format.setMinimumFractionDigits(0);
format.setMaximumFractionDigits(2);
return format.format(n);
}
you are using float datatype for result instead of use int type and parse operation value in int.
result = (int)(NumAf + NumberBf);
For Ref. DecimalFormat
Change as follows as you are using float as result you are getting decimal so use int,
private int result=0;
//and
result =(int) (NumAf + NumberBf);
OR
float one= 2.0;
float two= 2.5;
//DecimalFormat format = new DecimalFormat();
//format.setDecimalSeparatorAlwaysShown(false);
DecimalFormat format=new DecimalFormat("#,###.#");
System.out.println( format.format(one) );//prints 2
System.out.println( format.format(two) );//prints 2.5
I'm trying to figure out how to cast the response of the consume of a webservice, when casting the response envelope.bodyIn to my extended class object "BiometricConfigurationResponse" i'm getting this error:
java.lang.ClassCastException: org.ksoap2.serialization.SoapObject cannot be cast to org.tempuri.BiometricConfigurationResponse
The service is responding well and if i not cast it i get the dump right.
Any ideas?
This is what i'm doing:
BiometricConfigurationResponse response= null;
SoapObject obj = new SoapObject (wsNameSpace, methodName);
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.implicitTypes = true;
envelope.dotNet = true;
envelope.setOutputSoapObject(obj);
envelope.addMapping(wsNameSpace, "BiometricConfigurationResponse", new BiometricConfigurationResponse().getClass());
HttpTransportSE androidHttpTransport = new HttpTransportSE(wsURL);
androidHttpTransport.debug = true;
try {
String soapAction=wsNameSpace + methodName;
androidHttpTransport.call(soapAction, envelope);
System.out.println(androidHttpTransport.requestDump);
response = (BiometricConfigurationResponse)envelope.bodyIn;
}
catch (Exception e) {
e.printStackTrace();
}
And this is my custom class
package org.tempuri;
import java.util.Hashtable;
import org.ksoap2.serialization.PropertyInfo;
import org.ksoap2.serialization.SoapObject;
public final class BiometricConfigurationResponse extends SoapObject {
private int coderAlgorithm;
private int templateFormat;
private boolean juvenileMode;
private int qualityThreshold;
private boolean retryAcquisition;
private boolean acceptBadQualityEnrollment;
private boolean showQualityBar;
private boolean showQualityThreshold;
private int timeout;
private int timeoutQualityCoder;
private int enrollSecurityLevel;
private boolean securityLevelCompatibility;
private boolean liveImage;
private java.lang.String setCulture;
private int authenticationScore;
public BiometricConfigurationResponse() {
super("", "");
}
public void setCoderAlgorithm(int coderAlgorithm) {
this.coderAlgorithm = coderAlgorithm;
}
public int getCoderAlgorithm(int coderAlgorithm) {
return this.coderAlgorithm;
}
public void setTemplateFormat(int templateFormat) {
this.templateFormat = templateFormat;
}
public int getTemplateFormat(int templateFormat) {
return this.templateFormat;
}
public void setJuvenileMode(boolean juvenileMode) {
this.juvenileMode = juvenileMode;
}
public boolean getJuvenileMode(boolean juvenileMode) {
return this.juvenileMode;
}
public void setQualityThreshold(int qualityThreshold) {
this.qualityThreshold = qualityThreshold;
}
public int getQualityThreshold(int qualityThreshold) {
return this.qualityThreshold;
}
public void setRetryAcquisition(boolean retryAcquisition) {
this.retryAcquisition = retryAcquisition;
}
public boolean getRetryAcquisition(boolean retryAcquisition) {
return this.retryAcquisition;
}
public void setAcceptBadQualityEnrollment(boolean acceptBadQualityEnrollment) {
this.acceptBadQualityEnrollment = acceptBadQualityEnrollment;
}
public boolean getAcceptBadQualityEnrollment(boolean acceptBadQualityEnrollment) {
return this.acceptBadQualityEnrollment;
}
public void setShowQualityBar(boolean showQualityBar) {
this.showQualityBar = showQualityBar;
}
public boolean getShowQualityBar(boolean showQualityBar) {
return this.showQualityBar;
}
public void setShowQualityThreshold(boolean showQualityThreshold) {
this.showQualityThreshold = showQualityThreshold;
}
public boolean getShowQualityThreshold(boolean showQualityThreshold) {
return this.showQualityThreshold;
}
public void setTimeout(int timeout) {
this.timeout = timeout;
}
public int getTimeout(int timeout) {
return this.timeout;
}
public void setTimeoutQualityCoder(int timeoutQualityCoder) {
this.timeoutQualityCoder = timeoutQualityCoder;
}
public int getTimeoutQualityCoder(int timeoutQualityCoder) {
return this.timeoutQualityCoder;
}
public void setEnrollSecurityLevel(int enrollSecurityLevel) {
this.enrollSecurityLevel = enrollSecurityLevel;
}
public int getEnrollSecurityLevel(int enrollSecurityLevel) {
return this.enrollSecurityLevel;
}
public void setSecurityLevelCompatibility(boolean securityLevelCompatibility) {
this.securityLevelCompatibility = securityLevelCompatibility;
}
public boolean getSecurityLevelCompatibility(boolean securityLevelCompatibility) {
return this.securityLevelCompatibility;
}
public void setLiveImage(boolean liveImage) {
this.liveImage = liveImage;
}
public boolean getLiveImage(boolean liveImage) {
return this.liveImage;
}
public void setSetCulture(java.lang.String setCulture) {
this.setCulture = setCulture;
}
public java.lang.String getSetCulture(java.lang.String setCulture) {
return this.setCulture;
}
public void setAuthenticationScore(int authenticationScore) {
this.authenticationScore = authenticationScore;
}
public int getAuthenticationScore(int authenticationScore) {
return this.authenticationScore;
}
public int getPropertyCount() {
return 15;
}
public Object getProperty(int __index) {
switch(__index) {
case 0: return new Integer(coderAlgorithm);
case 1: return new Integer(templateFormat);
case 2: return new Boolean(juvenileMode);
case 3: return new Integer(qualityThreshold);
case 4: return new Boolean(retryAcquisition);
case 5: return new Boolean(acceptBadQualityEnrollment);
case 6: return new Boolean(showQualityBar);
case 7: return new Boolean(showQualityThreshold);
case 8: return new Integer(timeout);
case 9: return new Integer(timeoutQualityCoder);
case 10: return new Integer(enrollSecurityLevel);
case 11: return new Boolean(securityLevelCompatibility);
case 12: return new Boolean(liveImage);
case 13: return setCulture;
case 14: return new Integer(authenticationScore);
}
return null;
}
public void setProperty(int __index, Object __obj) {
switch(__index) {
case 0: coderAlgorithm = Integer.parseInt(__obj.toString()); break;
case 1: templateFormat = Integer.parseInt(__obj.toString()); break;
case 2: juvenileMode = "true".equals(__obj.toString()); break;
case 3: qualityThreshold = Integer.parseInt(__obj.toString()); break;
case 4: retryAcquisition = "true".equals(__obj.toString()); break;
case 5: acceptBadQualityEnrollment = "true".equals(__obj.toString()); break;
case 6: showQualityBar = "true".equals(__obj.toString()); break;
case 7: showQualityThreshold = "true".equals(__obj.toString()); break;
case 8: timeout = Integer.parseInt(__obj.toString()); break;
case 9: timeoutQualityCoder = Integer.parseInt(__obj.toString()); break;
case 10: enrollSecurityLevel = Integer.parseInt(__obj.toString()); break;
case 11: securityLevelCompatibility = "true".equals(__obj.toString()); break;
case 12: liveImage = "true".equals(__obj.toString()); break;
case 13: setCulture = (java.lang.String) __obj; break;
case 14: authenticationScore = Integer.parseInt(__obj.toString()); break;
}
}
public void getPropertyInfo(int __index, Hashtable __table, PropertyInfo __info) {
switch(__index) {
case 0:
__info.name = "coderAlgorithm";
__info.type = Integer.class; break;
case 1:
__info.name = "templateFormat";
__info.type = Integer.class; break;
case 2:
__info.name = "juvenileMode";
__info.type = Boolean.class; break;
case 3:
__info.name = "qualityThreshold";
__info.type = Integer.class; break;
case 4:
__info.name = "retryAcquisition";
__info.type = Boolean.class; break;
case 5:
__info.name = "acceptBadQualityEnrollment";
__info.type = Boolean.class; break;
case 6:
__info.name = "showQualityBar";
__info.type = Boolean.class; break;
case 7:
__info.name = "showQualityThreshold";
__info.type = Boolean.class; break;
case 8:
__info.name = "timeout";
__info.type = Integer.class; break;
case 9:
__info.name = "timeoutQualityCoder";
__info.type = Integer.class; break;
case 10:
__info.name = "enrollSecurityLevel";
__info.type = Integer.class; break;
case 11:
__info.name = "securityLevelCompatibility";
__info.type = Boolean.class; break;
case 12:
__info.name = "liveImage";
__info.type = Boolean.class; break;
case 13:
__info.name = "setCulture";
__info.type = java.lang.String.class; break;
case 14:
__info.name = "authenticationScore";
__info.type = Integer.class; break;
}
}
}
After several days of research i understood that WSDL autogenerated code parse Properties but not Atrributes. So what i did was this:
First i generate the stub code from my WSDL in this website: http://www.wsdl2code.com/pages/home.aspx
My webservice name is "nutriment" son when you call it in MainActivity you have to do this:
nutriment nws= new nutriment();
BiometricConfigurationResponse respuesta = nws.GetBiometricConfiguration();
Log.i(TAG, String.valueOf(respuesta.coderAlgorithm));
Log.i(TAG, String.valueOf(respuesta.templateFormat));
But it responses 0 in all cases because the WDSL stub files are parsing PROPERTIES NOT ATRIBUTES, so when you open the serialization generated file you'll got something like this:
import org.ksoap2.serialization.KvmSerializable;
import org.ksoap2.serialization.PropertyInfo;
import java.util.Hashtable;
import org.ksoap2.serialization.SoapObject;
import org.ksoap2.serialization.SoapPrimitive;
public class BiometricConfigurationResponse implements KvmSerializable {
public int coderAlgorithm;
public int templateFormat;
public BiometricConfigurationResponse(){}
public BiometricConfigurationResponse(SoapObject soapObject)
{
if (soapObject == null)
return;
if (soapObject.hasProperty("coderAlgorithm"))
{
Object obj = soapObject.getProperty("coderAlgorithm");
if (obj != null && obj.getClass().equals(SoapObject.class)){
SoapPrimitive j =(SoapPrimitive) obj;
coderAlgorithm = Integer.parseInt(j.toString());
}
else if (obj!= null && obj instanceof Number){
coderAlgorithm = (Integer) obj;
}
}
if (soapObject.hasProperty("templateFormat"))
{
Object obj = soapObject.getProperty("templateFormat");
if (obj != null && obj.getClass().equals(SoapPrimitive.class)){
SoapPrimitive j =(SoapPrimitive) obj;
templateFormat = Integer.parseInt(j.toString());
}else if (obj!= null && obj instanceof Number){
templateFormat = (Integer) obj;
}
}
}
#Override
public Object getProperty(int arg0) {
switch(arg0){
case 0:
return coderAlgorithm;
case 1:
return templateFormat;
}
return null;
}
#Override
public int getPropertyCount() {
return 15;
}
#Override
public void getPropertyInfo(int index, #SuppressWarnings("rawtypes") Hashtable arg1, PropertyInfo info) {
switch(index){
case 0:
info.type = PropertyInfo.INTEGER_CLASS;
info.name = "coderAlgorithm";
break;
case 1:
info.type = PropertyInfo.INTEGER_CLASS;
info.name = "templateFormat";
break;
}
#Override
public void setProperty(int arg0, Object arg1) {
}
#Override
public String getInnerText() {
// TODO Auto-generated method stub
return null;
}
#Override
public void setInnerText(String arg0) {
// TODO Auto-generated method stub
}
}
The trick is to modify the parsing so instead of get the properties(e.g.):
if (soapObject.hasProperty("coderAlgorithm")){
Object obj = soapObject.getProperty("coderAlgorithm");
if (obj != null && obj.getClass().equals(SoapObject.class)){
SoapPrimitive j =(SoapPrimitive) obj;
coderAlgorithm = Integer.parseInt(j.toString());
}
else if (obj!= null && obj instanceof Number){
coderAlgorithm = (Integer) obj;
}
}
Get the ATTRIBUTES (e.g.):
if (soapObject.hasAttribute("coderAlgorithm")) {
Object obj = soapObject.getAttribute("coderAlgorithm");
if (obj != null && obj.getClass().equals(SoapObject.class)){
SoapPrimitive j =(SoapPrimitive) obj;
coderAlgorithm = Integer.parseInt(j.toString());
}
else if (obj!= null && obj instanceof Number){
coderAlgorithm = (Integer) obj;
}
else if (obj!= null && obj instanceof String){
coderAlgorithm = Integer.parseInt(obj.toString());
}
}
In settngs existed checkbox, if it is checked, then a specific fragment must not be loaded. I have just 4 fragment and I use FragmentStatePagerAdapter to show them.
public class TabPagerAdapter extends FragmentStatePagerAdapter {
public TabPagerAdapter(FragmentManager fm) {
super(fm);
}
#Override
public Fragment getItem(int i) {
switch (i) {
case 0:
return new Fragment_One();
case 1:
return new Fragment_Two();
case 2:
return new Fragment_Three();
case 3:
return new Fragment_Four();
}
return null;
}
#Override
public int getCount() {
return 4;
}
}
As show fragments, which are not only check in the settings? I get value (true of false (Check or Uncheck) fragment, but how do not show this fragment, i dont know.
You have to adapt your getItem() method as well as the getCount() method.
Let's assume you have a method shouldShowFragment(int fragmentNumber) that tells me for a given fragment number from 0 to 3, whether it should be shown or not (depending on the settings).
Now, implement getCount() like so to return the number of fragments that should be shown:
public int getCount() {
int cnt = 0;
for (int i = 0; i < 4; i++) {
if (shouldShowFragment(i)) cnt++;
}
return cnt;
}
And implement getItem() like so to take the not showing fragments into account:
public Fragment getItem(int position) {
int cnt = -1;
for (int i = 0; i < 4; i++) {
if (shouldShowFragment(i)) cnt++;
if (cnt == position) {
switch(i) {
case 0 : return new Fragment_One();
case 1 : return new Fragment_Two();
case 2 : return new Fragment_Three();
case 3 : return new Fragment_Four();
}
}
}
return null;
}
First of all Save the all check buttons state globally(i.e. in shared preferences like btn1.setChecked == true/false whatever) and in above code do like below:-
#Override
public Fragment getItem(int i) {
switch (i) {
case 0:
if(btn0.isChecked == true)
return new Fragment_One();
case 1:
if(btn1.isChecked == true)
return new Fragment_Two();
case 2:
if(btn2.isChecked == true)
return new Fragment_Three();
case 3:
if(btn3.isChecked == true)
return new Fragment_Four();
}
return null;
}
Why is this code unreachable and how do I fix it?
public void draggingEvent() {
image15();
final int thisLetter = currentLetter;
mImageView15.getDrawable();
mImageView15 = (ImageView) findViewById(R.id.imageView15);
mImageView15.setOnDragListener(new OnDragListener() {
public boolean onDrag(View v, DragEvent de) {
// TODO Auto-generated method stub
final int action = de.getAction();
switch(action) {
case DragEvent.ACTION_DRAG_STARTED:
if (de.getClipDescription().hasMimeType(ClipDescription.MIMETYPE_TEXT_PLAIN)) {
v.invalidate();
return (true);
}
break;
case DragEvent.ACTION_DRAG_ENTERED:
v.invalidate();
return (true);
break; //un reachable here
case DragEvent.ACTION_DRAG_LOCATION:
//ignore even for now
if (de.getX() == 250 && de.getY() == 195) {
mImageView17.setImageResource(thisLetter);
v.invalidate();
return (true);
}
if (de.getX() == 300 && de.getY() == 195) {
mImageView17.setImageResource(thisLetter);
return (true);
}
break;// here
case DragEvent.ACTION_DRAG_EXITED:
de.getResult();
break; //here
case DragEvent.ACTION_DROP:
ClipData.Item item = de.getClipData().getItemAt(thisLetter);
v.invalidate();
return (true);
break; // here
case DragEvent.ACTION_DRAG_ENDED:
v.invalidate();
if (de.getResult()) {
Log.e("it worked", "worked");
} else {
Log.e("failed", "sorry failed drag and drop");
return (true);
}
break; //here
default:
Log.e("Drag drop", "Failed to find area");
break; // and here
};
return false;
};
});
You cannot execute any Java statement after return:
return (true);
break; //un reachable here
just have return statement. (you have two such occurrences)
In general, statements after a return statement in Java will not be executed.
This is almost correct; there is an important exception which helps program stability, that being the finally block. For example
try {
doSomething();
return;
} finally {
cleanUp();
}
the function cleanUp() will be executed.
Because you do return (true) before your break the break will never be called.
I've created a menu with a intents to access different activities, but I have a strange behavior, it always goes through all the cases of the switch statement after the statement selected , I've reviewed the value of the variable item and is correct, any ideas what could be wrong?
the snippet of code that represents the menu is:
public static final int wiifidi = 0;
public static final int cuentaint = 1;
public static final int cajerosint = 2;
public static final int indicadoresint = 3;
public static final int promoint = 5;
public static final int contactoint = 4;
....
....
....
#Override
//add the items to the menu on the class
public boolean onCreateOptionsMenu(Menu menu) {
boolean result = super.onCreateOptionsMenu(menu);
menu.add(0,wiifidi, 0, R.string.menu_wifi);
menu.add(0,cuentaint, 0, R.string.menu_cuenta);
menu.add(0,cajerosint,0,R.string.menu_cajeros);
menu.add(0,indicadoresint,0,R.string.menu_indicadores);
menu.add(0,contactoint,0,R.string.menu_contacto);
menu.add(0,promoint,0,R.string.menu_promo);
return result;
}
#Override
//handle everything that happens when an item of menu is selected
public boolean onOptionsItemSelected(MenuItem item) {
Toast.makeText(getApplicationContext(), "el item es " +item.getItemId(), Toast.LENGTH_LONG).show();
switch (item.getItemId()) {
case wiifidi:
wifistatus();
case cuentaint:{
consulta();
}
case cajerosint:{
cajero();
}
case indicadoresint:{
indicador();
}
case contactoint:{
contacto();
}
case promoint:{
promocion();
}
}
return super.onOptionsItemSelected(item);
}
Remember to break out of your switches.
switch (item.getItemId())
{
case wiifidi:
wifistatus();
break;
case cuentaint:
consulta();
break;
case cajerosint:
cajero();
break;
case indicadoresint:
indicador();
break;
case contactoint:
contacto();
break;
case promoint:
promocion();
break;
}
Specify break
case wiifidi:
wifistatus();
break;