I'm stuck during makeing my first simply app in Adroid Studio
1.)
Error38, 20) error: bad operand types for binary operator '-'
first type: int
second type: EditText
//Taking number from user
EditText = Age;
Age = (EditText) findViewById(R.id.inAge);
//Next, Tmax have to, 220 - user input number
Tmax = 220 - Age;
And here is this error with number - number from user input.
2.)
Error47, 16) error: non-static method setup() cannot be referenced from a static context
I have no idea why it is not working propertly.
TabHost tabHost = (TabHost) findViewById(R.id.tabHost);
TabHost.setup(); *//Why is error here?*
TabHost.TabSpec tabSpec = tabHost.newTabSpec("Calc");
tabSpec.setContent(R.id.Calc);
tabSpec.setIndicator("Calc");
tabHost.addTab(tabSpec);
tabSpec = tabHost.newTabSpec("Hints"); *//second table, witchout [TabHost.TabSpac] ??*
tabSpec.setContent(R.id.Hints);
tabSpec.setIndicator("Hints");
tabHost.addTab(tabSpec);
I have hope, somebody will help me with that.
Considering Wiek is your EditText
object:
Tmax = 220 - Integer.valueOf(Wiek.getText().toString());
tabHost.setup();
Explanation:
Wiek is an object, you first need to call getText to get the value that is entered inside of the object.
TabHost
is the class name and tabHost
is your instantiated view.