Search code examples
androidgoogle-glass

More info on menu selection Glass


I have a CardScrollView with several items in the list and I'd like to further expand upon a selected item with more information so for example:

  1. User swipes to a card
  2. user taps the side (or uses voice)
  3. the user selects "More Info" from the menu
  4. (NOT SURE ON THIS PART) A new activity launches with details from that card (these details are stored in the object)

Here is my code and it is failing at the text view part (this code is inside the mainactivity.java

case R.id.settings_3: //More Info
           Log.v("Option_selected", "More Info " + jCardScrollView.getSelectedItemPosition());
           List<Stuff> stuff = currJobList.getList();
           String textDesc = stuff.get(jCardScrollView.getSelectedItemPosition()).getStuffDesc();
           TextView view = (TextView) findViewById(R.id.init_text);
           view.setText(textDesc); // add the description text into new activity

           // launch the activity
           Intent infoIntent = new Intent(this,MoreInfoActivity.class);
           startActivity(infoIntent);

Solution

  • You should insert the description textView in the new activity in onCreate non before it's opened. You can send the textDesc String through activity with

    infoIntent.putExtra("textDesc", textDesc);
    

    and retrieve it in the new activity with

    Bundle extras = getIntent().getExtras();
    String desc=(String) extras.getString("textDesc");