I have searched the documentation end-on-end and tried numerous things but none worked so far.
The issue is that, after I have successfully built a class with working query system (SearchContentActivity.java)
and its supporting classes (UserContent.java, UserContentAdapter.java, UserContentBoxapp.java)
, I have to build a new database for One-to-Many relationship with the content (CategoryNameSet.java
, with only one attribute "String categoryName"
).
Most of the codes looks like the other query:
public class TestActivity extends AppCompatActivity {
private TextView textView;
private BoxStore store;
Box<CategoryNameSet> categoryNameSetBox;
List<CategoryNameSet> categoryNameSetList;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_test);
textView = (TextView) findViewById(R.id.activity_test_textView);
store = ((UserContentBoxApp) getApplication()).getBoxStore();
categoryNameSetBox = store.boxFor(CategoryNameSet.class);
categoryAdd();
}
private void categoryAdd() {
categoryNameSetList = categoryNameSetBox.query().contains(CategoryNameSet_.categoryName, "yahoo").build().find();
String text = "categoryNameSet instances: " + categoryNameSetBox.count()
+ ". Name of instances: " + categoryNameSetList;
textView.setText(text);}
}
When I ran the code, it displays full package name, class name, and @random string
example:
categoryNameSet instance: 155. Name of instances: [com.google.test.myapp.CategoryNameSet@ccd488d, com.google.test.myapp.CategoryNameSet@9910a42]
The number of results were two, which was the number of times put "yahoo" into categoryNameSetBox in another class. This indicates that the query can search and "see" the results.
How could I change the result from these random strings to categoryName attribute contained in the CategoryNameSet.java?