开发者

make an intent from an object onstead of a class

开发者 https://www.devze.com 2023-03-05 17:53 出处:网络
I\'m trying to make an intent by sending an object instead of a class. instead: I开发者_开发问答ntent intent = new Intent(EXGPS.this, LocationGPS.class);

I'm trying to make an intent by sending an object instead of a class.

instead:

I开发者_开发问答ntent intent = new Intent(EXGPS.this, LocationGPS.class);

I need:

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

I have to do it in some way cause I cant pass my LocationGPS contructor that is getting Context c.

thank you in advance :-)


Don't do it that way. Set up a Global class which has a static reference to your Application's Context. Reference that static field directly from your LocationGPS class.

0

精彩评论

暂无评论...
验证码 换一张
取 消