2016-10-01 55 views
0

我想通過Android註釋中的意圖發送和接收ArrayList。我怎樣才能做到這一點?如何在Android註釋中發送和接收ArrayList意圖

grid.setOnItemClickListener(new AdapterView.OnItemClickListener() { 

      @Override 
      public void onItemClick(AdapterView<?> parent, View view, 
            int position, long id) { 
       SubcriptionAddPage_.intent(activity).startForResult(REQUEST_CODE); 
       overridePendingTransition(R.anim.activity_in, R.anim.activity_out); 
      } 
     }); 

回答

0

在你Activity,你可以注入一個Intent額外這樣的:

@EActivity 
public class SubcriptionAddPage extends Activity { 

    @Extra 
    ArrayList<String> arrayListExtra; 

    @AfterInject 
    void afterInject() { 
    // you can use the injected extra here 
    } 

} 

SubcriptionAddPage_.intent(activity) 
    .arrayListExtra(list) // pass the extra to the generated builder 
    .startForResult(REQUEST_CODE) 
    .withAnimation(R.anim.activity_in, R.anim.activity_out); // you can use this instead of calling overridePendingTransition()