这是我的第一堂课:
public class TessAsyncEngine extends AsyncTask<Object, Void, String> {
private Activity acti;
Context mContext;
@Override
protected String doInBackground(Object... params) {
//something here
}
@Override
protected void onPostExecute(String s) {
Intent myIntent = new Intent(acti.getApplicationContext(), MainActivity.class);
myIntent.putExtra("mytext", s.toString());
acti.startActivity(myIntent);
super.onPostExecute(s);
}
}
第二名:
Bundle bundle = getIntent().getExtras();
String resuiltString= bundle.getString("mytext");
String s不为null,但resuiltString始终返回null。我试着改变但是失败了。你能帮助我吗?感谢收看。
答案 0 :(得分:0)
请使用以下代码:
String resuiltString = getIntent().getStringExtra("mytext");