Note that there are some explanatory texts on larger screens.

plurals
  1. POCommunication between running activities?
    primarykey
    data
    text
    <p>I'm new to android and is currently developing a quest/tresurehunt application. It is a prototype and is going to be evaluated in the field and i would therefore like to implement some sort of cheat to skip checkpoints if the application should crash during the tests.</p> <p>My application work the way that when you select a quest a activity will be loaded to handle all checkpoints and the user location(ActivityAdapter.java). This activity will open the diffrent navigation tool activities and pass information to them based on the next checkpont using intent. I have implemented a long press event in the app i would like to activate the skip/cheat. My problem is that i can't figure out how to do this.</p> <p>Location changed event of ActivityAdapter.java:</p> <pre><code>public void onLocationChanged(Location location) { location.distanceBetween(location.getLatitude(), location.getLongitude(), lat, lng, dist); if (dist[0]&lt;= 10) { if (cid == checkpoints.size()) { Intent intent = new Intent(ActivityAdapter.this, SuccessActivity.class); intent.putExtra("title", checkpoints.get(cid).get("title")); startActivity(intent); } else { new loadAndStartQuest().execute(); } } } </code></pre> <p>loadAndStartQuest() just find the next checkpoint and start the right activity (navigationtool). I have tryed creating a object of the ActivityAdapter and set a variable and add it to the the if statement which did not work. I guess it is because it will create another instance of the activity and not affect the current/running one. So how would you communicate between two running activities?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload