Intent的调用

//Intent  intent=new Intent();
//intent.setClass(MainActivity.this, GPSService.class);
//以上二条可以合并成如下一条
Intent intent = new Intent(this,GPSService.class);
intent.putExtra("data1","youdata");
startActivit(intent );
//如果定义了Service,则调用startService(intent);  
获取数据
getIntent().getExtras().get("data1");


原文地址:https://www.cnblogs.com/gszw/p/7768110.html