我真的是安卓系统的新手。请给我一些帮助。先谢谢你!下面的代码是一部分。第二 活动
public class getInfoActivity extends AppCompatActivity{
public TextView textViewCityName;
public TextView textViewTemp;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
textViewCityName = (TextView) findViewById(R.id.textViewCityName);
textViewTemp = (TextView) findViewById(R.id.textViewTemp);
...
然后是 AsyncTask onPostExecute(后执行) 代码。
protected void onPostExecute(Double aDouble) {
//textViewCityName.setText("2172729"); //crashed the APP
Toast.makeText(getInfoActivity.this, "2172729",
Toast.LENGTH_SHORT).show(); //working
}
错误信息
FATAL EXCEPTION: main
java.lang.NullPointerException
太感谢你了!
好的,用这个 textViewCityName.get().setText("2172729");