public class MainActivity extends AppCompatActivity { private TextView tv; private String ni="https://www.toutiao.com/api/pc/focus/"; Handler handler=new Handler(){ @Override public void handleMessage(Message msg) { String b= (String) msg.obj; tv.setText(b); } }; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); tv = (TextView) findViewById(R.id.tv); new Thread(){ private List<Mybean.DataBean.PcFeedFocusBean> list; private String title; @Override public void run() { String tonet = Myutil.tonet(ni); Gson gson = new Gson(); final Mybean mybean = gson.fromJson(tonet, Mybean.class); list = mybean.getData().getPc_feed_focus(); Timer t=new Timer(); TimerTask tt=new TimerTask() { int i=0; @Override public void run() { if (i<=list.size()-1){ Message m=new Message(); String title = list.get(i).getTitle(); m.obj=title; handler.sendMessage(m); i++;}else if (i==list.size()){ i=0; Message m=new Message(); String title = list.get(i).getTitle(); m.obj=title; handler.sendMessage(m); i++; } } }; t.schedule(tt,1,3000); } }.start(); } }