Android: network relationship graph


I'll first explain what I'm trying to achieve and later on explain my current approach to solving it. I'm thankful for any useful input even if it would mean to start from scratch. I'll add more code or explanation if needed.

This is going to be a part of a bigger Android application. This part should display all nodes within a prior selected network and the relationships between the nodes all in one scrollable view/layout. The relationships should be pictured by arrows between the nodes, showing which nodes each node could 'hear' during a certain interval. The nodes sadly have to be clickable, because you have to able to set some options for other parts of the app within that view already. The actual data (nodes, neighbourhood relationships) should finally be returned via a webservice from a database, but this is not yet entirely relevant apart from the fact that the amount of nodes isn't static.

My current approach to this is to create GridView fill it with a custom ButtonAdapter, that way I can use a non-static amount of custom (transparent) buttons.

GridView gridview = (GridView) findViewById(R.id.gridview); gridview.setAdapter(new ButtonAdapter(this));

I have created methods that can draw arrows on a Bitmap and I can also easily set it as the GridView's background by converting it to Drawable.

protected Bitmap drawArrow(float startX, float startY, float endX, float endY, Bitmap bitmap) { .... } Drawable d = new BitmapDrawable(bitmap); gridview.setBackgroundDrawable(d);

My issue with that approach is, that I'd need to know the exact size of the GridView for the Bitmap and the position of the buttons or alternatively the total height and width, that 1 button would use. Due to creating it within the onCreate I don't get the actual sizes at this point though. Is there a solution to this problem?

And even if that'd work I'm not sure just yet whether I can set the background in a way that it would scroll 1:1 with the GridView instead of getting scaled.


Solved with a custom SurfaceView utilizing a custom thread and an extra class for each button which are simply drawn together with the lines between them on the surface. Scrolling had to be individually implemented as well.


  • Getting neighbourhood boundaries from Google Maps API
  • Here API clustering error: “addLayer is not defined”
  • Google Maps Highlight a particular area
  • Deserialize a type containing a Dictionary property using ServiceStack JsonSerializer
  • Optimal way to set pixel data?
  • Facebook Logout Confusion
  • css font-size and line-height not matching the baseline
  • Certain Arabic text gets incorrectly shown while other Arabic text gets showed normally?
  • How to implement Deep Linking in Roku SG application?
  • Can my PDF ping my server when it is opened?
  • Simple linked list-C
  • Python ImageIO Gif Set Delay Between Frames
  • Salesforce Different WSDL files and when to use
  • Invalid Date on validation Date of js
  • CakePHP ACL tutorial initDB function warnings
  • presentShareDialogWithParams posts to FB wall, but callback handler results say error
  • How integrated is Collada to OpenGL ES
  • Time complexity of a program which involves multiple variables
  • ActiveRecord query for a count of new users by day
  • Checking free space on FTP server
  • Deleting and Updating values from a cusrsor adapter
  • req.body is undefined - nodejs
  • How to make a tree having multiple type of nodes and each node can have multiple child nodes in java
  • Get object from AWS S3 as a stream
  • Modifying destination and filename of gulp-svg-sprite
  • 'TypeError' while using NSGA2 to solve Multi-objective prob. from pyopt-sparse in OpenMDAO
  • Symfony2: How to get request parameter
  • Akka Routing: Reply's send to router ends up as dead letters
  • Return words with double consecutive letters
  • Is there a mandatory requirement to switch app.yaml?
  • NSLayoutConstraint that would pin a view to the bottom edge of a superview
  • How to set the response of a form post action to a iframe source?
  • embed rChart in Markdown
  • Change div Background jquery
  • Qt: Run a script BEFORE make
  • How to get NHibernate ISession to cache entity not retrieved by primary key
  • reshape alternating columns in less time and using less memory
  • How can i traverse a binary tree from right to left in java?
  • How can I use `wmic` in a Windows PE script?
  • Unable to use reactive element in my shiny app