答案 0 :(得分:1)
在名为 SecondClass.java 的第二个活动的java类中创建一个静态变量:
public static String public_ip;
然后在你的MainActivity中:
@Override
protected void onPostExecute(String result) {
super.onPostExecute(result);
//Add this
SecondClass.public_ip = result;
pubView = (TextView) activity.findViewById(R.id.ip);
pubView.setText(result);
async = null;
pubView = null;
}