从对象而不是类中创建一个intent

时间:2011-05-14 17:39:41

标签: android gps android-intent


我试图通过发送一个对象而不是一个类来实现一个意图。
代替:

Intent intent = new Intent(EXGPS.this, LocationGPS.class);

我需要:

LocationGPS gps = new LocationGPS(this);
Intent intent = new Intent(EXGPS.this, gps);

我必须以某种方式执行此操作,因为我无法通过正在获取Context c的LocationGPS构造函数。
提前谢谢:-)

1 个答案:

答案 0 :(得分:0)

不要这样做。设置一个Global类,其中包含对Application Context的静态引用。直接从LocationGPS类引用静态字段。