I looks like a simple question, but i can't manage to get it to work.
我看起来像一个简单的问题,但我无法让它工作。
I'm trying to make weather app, and im using Yahoo API, And like this the app works:
我正在尝试制作天气应用程序,我正在使用Yahoo API,这样的应用程序工作:
service.refreshWeather("Dallas, TX");
I wanted to make the user input the city, so i made this:
我想让用户输入城市,所以我做了这个:
mButton = (Button)findViewById(R.id.mDugme);
mEdit = (EditText)findViewById(R.id.unesiGrad);
String userInput11;
mButton.setOnClickListener(
new View.OnClickListener()
{
public void onClick(View view)
{
userInput11 = mEdit.getText().toString();
}
});
service.refreshWeather(userInput11);
Why isn't it working?
为什么不工作?
1 个解决方案
#1
1
Take this code
拿这个代码
mButton.setOnClickListener(
new View.OnClickListener()
{
public void onClick(View view)
{
userInput11 = mEdit.getText().toString();
}
});
service.refreshWeather(userInput11);
and reorder it to look like this
并重新排序,看起来像这样
mButton.setOnClickListener(
new View.OnClickListener()
{
public void onClick(View view)
{
userInput11 = mEdit.getText().toString();
service.refreshWeather(userInput11);
}
});
It may demand to declare service as final. I am not sure. Just follow IDE instructions.
它可能要求将服务声明为最终服务。我不确定。只需按照IDE说明操作。
#1
1
Take this code
拿这个代码
mButton.setOnClickListener(
new View.OnClickListener()
{
public void onClick(View view)
{
userInput11 = mEdit.getText().toString();
}
});
service.refreshWeather(userInput11);
and reorder it to look like this
并重新排序,看起来像这样
mButton.setOnClickListener(
new View.OnClickListener()
{
public void onClick(View view)
{
userInput11 = mEdit.getText().toString();
service.refreshWeather(userInput11);
}
});
It may demand to declare service as final. I am not sure. Just follow IDE instructions.
它可能要求将服务声明为最终服务。我不确定。只需按照IDE说明操作。