...
Code Block |
---|
language | java |
---|
theme | Eclipse |
---|
title | Example Register Activity |
---|
|
public class MyRegisterActivity extends SmartRegisterSecuredActivity {
@Override
public SecuredNativeSmartRegisterFragment makeBaseFragment() {
// Return a fragment which generates the list view i.e. main grid fragment. Example is given below
return new MyMainRegisterFragment(new FormController(this));
}
@Override
public DetailFragment getDetailFragment() {
// Fragment handling details view for list records. Example would be in section Details view
// Or return null if no details view is applicable
return new MyDetailFragment();
}
@Override
protected String[] buildFormNameList() {
// Return a list of form names which would participate in data collection from this register.
// These froms are added to assets and generated via xlsforms
List<String> formNames = new ArrayList<String>();
formNames.add("my_form1");
formNames.add("my_form2");
formNames.add("my_form3");
return formNames.toArray(new String[formNames.size()]);
}
@Override
public String postFormSubmissionRecordFilterField() {
// The field which filters out data on successful form submission to highlight the new/updated record.
// The field should be a valid non-null field in your xlsform and should identify record uniquely, otherwise multiple records would be highlighted
// Return null if no data needs to be highlighted
return "my_beneficiary_id_in_form_submission";
}
@Override
protected void onResumption() {
// Any custom tasks on Resumption of activity
}
} |
2- Create Base Fragment
Once you have created register activity, next step is to create the fragment that is actually reponsible for showing list records i.e. main grid. The example is here
Code Block |
---|
language | java |
---|
theme | Eclipse |
---|
title | Example Base Register Fragment |
---|
|
|