android - Update a View through AsyncTask -


I am currently writing an Android game app using the device's GPS features. I have been exposed to some problems here, my player class is

  public class player {Private int x core; Private int yCor; Public player (int x core, int yCor) {this.xCor = xCor; this. yCor = yCor; }}   

This is my gamefaceview view

  Extension of the public class game site {Private Arrival & Lieutenant; Ghost & gt; ghostList; Private paint paint; Public GameForf (reference references, AttributeSet attrs, int defStyleAttr) {super (references, attrs, defStyleAttr); in this(); } Public Sport Surf (Reference Reference, AttributeSet attrs) {Super (References, ethers); in this(); } Public GameForf (Reference Reference) {Super (Reference); in this(); } Public zero init () {color = new paint (); Paint.setColor (0xff00ff00); // Single int (green) in hex // First FF = opaque; First 00 = any red // second FF = green on all the way; Second 00 = No blue // can not even do: paint.setColor (Color.GREEN); Paint.setStyle (Style.STROKE); Paint.setStrokeWidth (3); } @ Override Public Wide On Draw (Canvas C) {} `  

And here is my Asinca Task Class

  Public class update location Async Task & lt ; GameSurface Expands GameSurface, Integer & gt; {@ Override protected integer doinbackground (GameSpace ... Parameters) @ Override Preferred Protective Zero Promotion Update (GameSurfS ... parameter) {} `  p> I want to get GPS coordinates in AsyncTask and want to use those coordinates to update the location of a board (player) in the scene. How can I go about doing this?   

You can send a reference to the asynchronous (activity that controls the scene):

  public class AsyncTask {protected void execute (reference references, hashmop & lt; string, string & gt; ... parameters) {...   

then in AsyncTask On the OnPostExecute method, you can call a method of activity to update the view. PostExecute (Hashmap> string, string & gt; results) {(MyActivity Reference) on the @Override protected void) .updateView (Results); }

Comments

Popular posts from this blog

Verilog Error: output or inout port "Q" must be connected to a structural net expression -

jasper reports - How to center align barcode using jasperreports and barcode4j -

c# - ASP.NET MVC - Attaching an entity of type 'MODELNAME' failed because another entity of the same type already has the same primary key value -