public void update_profile(View view) { ProgramMetadata chosenProgramMetadata = eligiblePrograms.get(0); Log.v("PROGRAMSELECT", chosenProgramMetadata.toString()); Log.v("PROGRAMSELECT", chosenProgramMetadata.getId()); MuskAPI APIGuy = APIClient.getAPIClient(); APIGuy.programSelect( DataStore.getUserId(), chosenProgramMetadata.getId(), DataStore.getUwyaId(), DataStore.getUwywId(), new APICallback<ProgramSelectResponse, ProgramSelectResponseData>(getApplicationContext()) { @Override public void onSuccess(ProgramSelectResponseData data) { Log.v("PROGRAMSELECT", data.toString()); Intent intent = new Intent(getApplicationContext(), Dashboard.class); startActivity(intent); } @Override public void onFailure(String errorMessage) {} }); }
@Override protected void onCreate(Bundle savedInstanceState) { /* Insert code to get plans from database by sending user preferences*/ super.onCreate(savedInstanceState); setContentView(R.layout.activity_plan_grid); eligiblePrograms = DataStore.getEligiblePrograms(); programList = (ListView) findViewById(R.id.lvProgramList); ProgramInfoArrayAdapter adapter = new ProgramInfoArrayAdapter(this, eligiblePrograms); programList.setAdapter(adapter); programList.setOnItemClickListener( new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { update_profile(view); } }); Log.v("ELIGIBLE_PROGRAMS", eligiblePrograms.toString()); }