Android Development: Simple collision detection

For my App I need to know when a user drags a specified element on top of another element. For instance when they drag one of their attack cards to the deck of the oponnent. On top of that I also need to know if the current location will result in an attack movement or …

Android Development: Loading image

In a previous post I talked about loading bitmaps. In this post I will tell something about caching the loaded resources. For this I created a little util class. To give you an example how to use it here is the code. I will explain it step by step. private Matrix scaleMatrix; public UICard build(Card …

Android Development: Adding touch support

When creating an App users need to somehow interact with your program. Mostly this will include touch support. To set up touch support you need to do the following¬†Warning lots of code !!¬†I will try to explain everything step by step. Lines 8, 39,73: Listen to the various events. Line 11-28: When a mouse-down event …

Android development: Loading bitmaps

If you want to add graphics to your application you can use the following information Create a custom Activity like this public class GameActivity extends Activity implements Observer{ private static final String TAG = “StrategoGameActivity”; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); super.setContentView(new StrategoGameView(this)); ActionBar actionBar = getActionBar(); actionBar.hide(); } @Override public void update(Observable observable, …

Android Development: Responding to a socket request

Warning: Worst Blog post written ever in history! in my current project, a simple multiplayer game, I need to react on a connection request from another device. Currently both devices start their own service discovery. On one device I go to the list of found services and pick on. On the click the ServiceHelper will …

Android Development: Starting a server socket

As you already know the application i’m building is using service discovery to connect to other devices. How does this work? Step 0:  Add activity as observer to the servicehelper class (line 4) Step 2: Start registering the service to the network (10) protected void onResume() { Log.d(TAG, “On Resume called”); ServiceHelper.getInstance(this).addObserver(this); if (!ServiceHelper.getInstance(this).hasServiceRegistered( StrategoService.SERVICE_NAME, …