Hi i have one table "TABLE_OBJECTIVE" with 1 question and 4 option which i accept from
EditText. My question is that how to show this Question as parent and 4 option as child
in expandable list view. i use some code but it doesn't display question and display only
one option out of 4.
Here is my sample code.
public class ObjectiveExamActivity extends ExpandableListActivity {
#SuppressWarnings("unchecked")
public void onCreate(Bundle savedInstanceState) {
try{
super.onCreate(savedInstanceState);
setContentView(R.layout.displayobjectiveque);
Intent intent=getIntent();
setResult(RESULT_OK, intent);
SimpleExpandableListAdapter expListAdapter =
new SimpleExpandableListAdapter(
this,
createGroupList(),
R.layout.group_row,
new String[] { "Group Item" },
new int[] { R.id.row_name },
createChildList(),
R.layout.child_row,
new String[] {"Sub Item"},
new int[] { R.id.grp_child}
);
setListAdapter( expListAdapter );
}catch(Exception e){
System.out.println("Errrr +++ " + e.getMessage());
}
}
#SuppressWarnings("unchecked")
private List createGroupList() {
ArrayList result = new ArrayList();
final MySQLiteHelper m=new MySQLiteHelper(getBaseContext());
final ArrayList<ObjectiveWiseQuestion> LocWiseProfile= (ArrayList<ObjectiveWiseQuestion>) m.getAllObjectiveQuestion();
for (final ObjectiveWiseQuestion cn : LocWiseProfile)
{
HashMap m1=new HashMap();
m1.put("Question",cn.getQuestion());
result.add(m1);
}
return (List)result;
}
#SuppressWarnings("unchecked")
private List createChildList()
{
final MySQLiteHelper m=new MySQLiteHelper(getBaseContext());
final ArrayList<ObjectiveWiseQuestion> LocWiseProfile= (ArrayList<ObjectiveWiseQuestion>) m.getAllObjectiveQuestion();
ArrayList result = new ArrayList();
for (final ObjectiveWiseQuestion cn : LocWiseProfile)
{
/* each group need each HashMap-Here for each group we have 4 subgroups */
ArrayList secList = new ArrayList();
for(ObjectiveWiseQuestion cn1: LocWiseProfile)
{
HashMap child = new HashMap();
//child.putAll(cn.getOptionA(),cn.getOptionB(),cn.getOptionC());
child.put( "Sub Item", "Sub Item " + cn.getOptionA() );
child.put("", cn.getOptionB());
child.put("Option C", cn.getOptionC());
child.put("Option D", cn.getOptionD());
secList.add( child );
}
result.add( secList );
}
return result;
}
I really don't understand where the problem in my code.
Please give me some hint or reference.
Here is image of emulator which show only one item.
I have 4 option(Google,Samsung,Nokia,Onida).
Thanks in Advance.
Hi please try this code its working fine for me for one question but as i used array list and hashmap you can use length and size functions for multiple questions
public class ShowQuiz extends Activity {
/** Called when the activity is first created. */
ExpandableListView expandableListView;
HashMap<String, Options> hashMap;
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
Options options=new Options();
hashMap=new HashMap<String, Options>(1);
hashMap.put("Which is Domestic Animal?", options);
expandableListView=(ExpandableListView) findViewById(R.id.ev);
expandableListView.setAdapter(new QuizQuestionAdapter());
}
class QuizQuestionAdapter extends BaseExpandableListAdapter
{
#Override
public Object getChild(int groupPosition, int childPosition) {
// TODO Auto-generated method stub
return hashMap.get(0).fetchOptions().get(childPosition);
}
#Override
public long getChildId(int groupPosition, int childPosition) {
// TODO Auto-generated method stub
return 0;
}
#Override
public View getChildView(int groupPosition, int childPosition,
boolean isLastChild, View convertView, ViewGroup parent) {
// TODO Auto-generated method stub
TextView textView=new TextView(ShowQuiz.this);
textView.setText(hashMap.get("Which is Domestic Animal?").getQuestion(childPosition).toString());
return textView;
}
#Override
public int getChildrenCount(int groupPosition) {
// TODO Auto-generated method stub
return 4;
}
#Override
public Object getGroup(int groupPosition) {
// TODO Auto-generated method stub
return hashMap.get(0);
}
#Override
public int getGroupCount() {
// TODO Auto-generated method stub
return 1;
}
#Override
public long getGroupId(int groupPosition) {
// TODO Auto-generated method stub
return 0;
}
#Override
public View getGroupView(int groupPosition, boolean isExpanded,
View convertView, ViewGroup parent) {
// TODO Auto-generated method stub
TextView textView=new TextView(ShowQuiz.this);
textView.setText("Which is Domestic Animal?");
return textView;
}
#Override
public boolean hasStableIds() {
// TODO Auto-generated method stub
return false;
}
#Override
public boolean isChildSelectable(int groupPosition, int childPosition) {
// TODO Auto-generated method stub
return false;
}
}
class Options
{
ArrayList<String> optns;
Options()
{
optns=new ArrayList<String>(4);
optns.add("rat");
optns.add("cat");
optns.add("dog");
optns.add("tiger");
}
public ArrayList<String> fetchOptions()
{
return this.optns;
}
public String getQuestion(int position)
{
return optns.get(position);
}
}
}
Related
in the App im developing, i got a List of messages with titel datum etc.
When clicking on the Messagetitel i want to sliding expand this entry and show the Details, and some new buttons like "reply" , "delete" and "forward".
like:
- message
- message (clicked message)
details buttons delete , forward , reply
text
- message
- message
Here is what i did so far:
first my Model Class for the messages:
public class MyMessage {
private String from;
private String subject;
private String date;
private String message;
public MyMessage(String f, String s, String d, String m){
from= f;
subject= s;
date = d;
message= m;
}
public String getFrom() {
return from;
}
public String getSubject() {
return subject;
}
public String getDate() {
return date;
}
public String getMessage() {
return message;
}
}
my Custom Adapter:
public class NewAdapter extends BaseExpandableListAdapter {
public ArrayList<MyMessage> mMessage;
public LayoutInflater minflater;
public Activity activity;
public NewAdapter(ArrayList<MyMessage> message){
mMessage = message;
}
public void setInflater(LayoutInflater mInflater, Activity act) {
this.minflater = mInflater;
activity = act;
}
#Override
public Object getChild(int groupPosition, int childPosition) {
// TODO Auto-generated method stub
return null;
}
#Override
public long getChildId(int groupPosition, int childPosition) {
// TODO Auto-generated method stub
return 0;
}
#Override
public View getChildView(int groupPosition, int childPosition,
boolean isLastChild, View convertView, ViewGroup parent) {
TextView text = null;
// TODO Auto-generated method stub
if (convertView == null) {
convertView = minflater.inflate(R.layout.message_details, null);
}
text = (TextView) convertView.findViewById(R.id.tv_message_text);
text.setText(mMessage.get(childPosition).getMessage());
return convertView;
}
#Override
public int getChildrenCount(int groupPosition) {
// TODO Auto-generated method stub
return 0;
}
#Override
public Object getGroup(int groupPosition) {
// TODO Auto-generated method stub
return null;
}
#Override
public int getGroupCount() {
// TODO Auto-generated method stub
return 0;
}
#Override
public long getGroupId(int groupPosition) {
// TODO Auto-generated method stub
return 0;
}
#Override
public View getGroupView(int groupPosition, boolean isExpanded,
View convertView, ViewGroup parent) {
TextView from= null;
TextView date = null;
TextView subject= null;
// TODO Auto-generated method stub
if(convertView == null){
convertView = minflater.inflate(R.layout.message_head, null);
}
from= (TextView) convertView.findViewById(R.id.tv_from);
date = (TextView) convertView.findViewById(R.id.tv_date);
subject= (TextView) convertView.findViewById(R.id.tv_subject);
from.setText(mMessage.get(groupPosition).getfrom());
date.setText(mMessage.get(groupPosition).getDate());
subject.setText(mMessage.get(groupPosition).getSubject());
return convertView;
}
#Override
public boolean hasStableIds() {
// TODO Auto-generated method stub
return false;
}
#Override
public boolean isChildSelectable(int groupPosition, int childPosition) {
// TODO Auto-generated method stub
return false;
}
}
my main Class:
public class Test extends ExpandableListActivity{
public ArrayList<MyMessage> message;
public ExpandableListView eListView;
#Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_test);
eListView = getExpandableListView();
message = createMessages();
NewAdapter nAdapter = new NewAdapter(message);
nAdapter
.setInflater(
(LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE),
this);
getExpandableListView().setAdapter(nAdapter);
}
private ArrayList<MyMessage> createMessages() {
ArrayList<MyMessage> m = new ArrayList<MyMessage>();
MyMessage test1 = new MyMessage("test1", "testbetreff", "08.11.2013 / 09:44", "gaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaanz viel text und so");
MyMessage test2 = new MyMessage("test2", "testbetreff", "08.11.2013 / 09:45", "gaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaanz viel text und so gaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaanz viel text und so");
MyMessage test3 = new MyMessage("test3", "testbetreff", "08.11.2013 / 09:46", "gaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaanz viel text und so gaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaanz viel text und so gaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaanz viel text und so");
MyMessage test4 = new MyMessage("test4", "testbetreff", "08.11.2013 / 09:47", "gaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaanz viel text und so gaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaanz viel text und so gaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaanz viel text und so gaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaanz viel text und so");
m.add(test1);
m.add(test2);
m.add(test3);
m.add(test4);
return m;
}
}
i dont get any errors but my activity is blank. I tried to debug this but it never calls getchildview() or getgroupview() and i dont know why.
am im doing any big mistakes with the costum adapter ?
thanks in advance
#Override
public int getChildrenCount(int groupPosition) {
return 1; //just one children?
}
#Override
public Object getGroup(int groupPosition) {
return mMessage.get(groupPosition);
}
#Override
public int getGroupCount() {
return mMessage.size();
}
#Override
public long getGroupId(int groupPosition) {
return groupPosition;
}
Try this... maybe it's not called because you said that the adapter has no items at all...
I have an expandablelistview which contain n number of group's. Each group contains single child that contains diffrent counts of textview like , Group 1 s child contains 10 textview ,
Groups 2 child contains 4 textview etc. My issue is that when i show notes(Textviews) of Group 1 on expand Groups 2 child also showing the same notes. Can any one tell me how to differentiate between groups child or add different items to different child's ?
Sorry i cant paste the full code here
public class ExpandableListAdapter extends BaseExpandableListAdapter {
private Context mContext;
private ExpandableListView mExpandableListView;
private List<GroupEntity> mGroupCollection;
private int[] groupStatus;
private ArrayList<HashMap<String, String>> data;
public ExpandableListAdapter(Context pContext,
ExpandableListView pExpandableListView,
List<GroupEntity> pGroupCollection, ArrayList<HashMap<String, String>> d, String jobID2 ,String userId, String totalTasks) {
mContext = pContext;
mGroupCollection = pGroupCollection;
mExpandableListView = pExpandableListView;
data=d;
jobId =jobID2;
groupStatus = new int[mGroupCollection.size()];
totalNoTask=totalTasks;
userKey=userId;
setListEvent();
}
private void setListEvent() {
mExpandableListView
.setOnGroupExpandListener(new OnGroupExpandListener() {
#Override
public void onGroupExpand(int arg0) {
// TODO Auto-generated method stub
groupStatus[arg0] = 1;
}
});
mExpandableListView
.setOnGroupCollapseListener(new OnGroupCollapseListener() {
#Override
public void onGroupCollapse(int arg0) {
// TODO Auto-generated method stub
groupStatus[arg0] = 0;
}
});
}
#Override
public String getChild(int arg0, int arg1) {
// TODO Auto-generated method stub
return mGroupCollection.get(arg0).GroupItemCollection.get(arg1).Name;
}
#Override
public long getChildId(int arg0, int arg1) {
// TODO Auto-generated method stub
return 0;
}
#Override
public View getChildView(int arg0, int arg1, boolean arg2, View arg3,
ViewGroup arg4) {
// TODO Auto-generated method stub
HashMap<String, String> song = new HashMap<String, String>();
song = data.get(arg0);
for (String key : song.keySet()) {
String tId =key;
String value = song.get("id");
taskID= value;
}
final EditText textView ;
ImageButton imGbtn ;
final ChildHolder childHolder;
if (arg3 == null) {
}
return arg3;
}
#Override
public int getChildrenCount(int arg0) {
// TODO Auto-generated method stub
return mGroupCollection.get(arg0).GroupItemCollection.size();
}
#Override
public Object getGroup(int arg0) {
// TODO Auto-generated method stub
return mGroupCollection.get(arg0);
}
#Override
public int getGroupCount() {
// TODO Auto-generated method stub
return mGroupCollection.size();
}
#Override
public long getGroupId(int arg0) {
// TODO Auto-generated method stub
return arg0;
}
}
I have a listview with textview and checkbox. The text values are stored in a HashMap. Data is retrieved from a DB. Map key is the ID and Map value is a Location. When I pass the HashMap to the adapter, it starts printing from position 0 (zero). Because of this I get a null text(with no value) and miss one value(the last one) in the HashMap. Can't I use a HashMap as the data source?
EDIT: Here is the code
public class LocationActivity extends Activity{
myAdapter myA;
Map<Integer,String> locLables;
#Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.locationmain);
ListView listview = (ListView) findViewById(R.id.listView1);
String selectQuery = "SELECT * FROM " + DatabaseHandler.TABLE_LOCATIONLABLES;
SQLiteDatabase db = new DatabaseHandler(this).getReadableDatabase();
Cursor cursor = db.rawQuery(selectQuery, null);
locLables = new HashMap<Integer, String>();
if(cursor != null){
if (cursor.moveToFirst()) {
do {
locLables.put(new Integer(cursor.getString(0)),cursor.getString(1));
System.out.println(cursor.getString(0)+" "+ cursor.getString(1));
} while (cursor.moveToNext());
}
}
cursor.close();db.close();
//System.out.println(locLables);
myA = new myAdapter(this, locLables, listview);
listview.setAdapter(myA);
listview.setOnItemClickListener(new OnItemClickListener() {
#Override
public void onItemClick(AdapterView<?> arg0, View arg1, int arg2,
long arg3) {
if(arg2 == 0 )
arg2 = arg2+1;
// TODO Auto-generated method stub
Toast.makeText(getApplicationContext(), locLables.get(arg2), Toast.LENGTH_SHORT).show();
}
});
}
Here is the Adapter class
class myAdapter extends BaseAdapter{
ListView listView;
Activity cntx;
Map<Integer,String> locations;
List<Integer> locids = new LinkedList<Integer>();
public myAdapter(Activity context,Map<Integer,String> locLables, ListView lv){
cntx = context;
locations = locLables;
listView = lv;
System.out.println(locations);
}
#Override
public int getCount() {
// TODO Auto-generated method stub
return locations.size();
}
#Override
public Object getItem(int arg0) {
// TODO Auto-generated method stub
return arg0;
}
#Override
public long getItemId(int arg0) {
// TODO Auto-generated method stub
return arg0;
}
#Override
public View getView(int position, View convertView, ViewGroup parent) {
// TODO Auto-generated method stub
View row=null;
final int posi = position;
LayoutInflater inflater=cntx.getLayoutInflater();
row=inflater.inflate(R.layout.locationmain_entry, null);
TextView tv = (TextView)row.findViewById(R.id.textView12);
final CheckBox cb = (CheckBox)row.findViewById(R.id.checkBox12);
if(locids.contains(posi))
cb.setChecked(true);
//here I get a null value as the first element and misses the last value..
tv.setText(locations.get(position));
cb.setOnCheckedChangeListener(new OnCheckedChangeListener() {
#Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
// TODO Auto-generated method stub
if(isChecked){
System.out.println("Chedked" + posi+ locations.get(posi));
//cb.setChecked(true);
if(!locids.contains(posi))
locids.add(posi);
//System.out.println(locids.get(posi));
}else if(!isChecked){
//cb.setChecked(false);
if(locids.contains(posi))
locids.remove(new Integer(posi));
System.out.println("NOt checked" +posi + locations.get(posi));
}
}
});
return row;
}
It runs for the number of elements in the Map. As it is using a 0 (by position variable) it misses the last value as well.
What you can do is
ArrayList<Hashmap<Integer,String>> myList = new ArrayList<Hashmap<Integer,String>>();
if(cursor != null){
if (cursor.moveToFirst()) {
do {
locLables = new HashMap<Integer, String>();
locLables.put(new Integer(cursor.getString(0)),cursor.getString(1));
myList.add(locLables);
} while (cursor.moveToNext());
}
}
cursor.close();db.close();
myA = new myAdapter(this, myList, listview);
listview.setAdapter(myA);
You will have to change your "myAdapter" Adapter's constructor to hold "ArrayList> myList" instead of "Map locLables"..
This will help... Let me know if the problem still persists..
I have a ListActivity extended class in that i want to display the names of cities and states. Cities should be in blue and states must be in red, i'm using a ListView and an ArrayAdapter to display the list. I've searched a lot but all I've got is using XMLs.
Anyone please help me.. Thanks in advance.
My code looks like this:
String cities[]={"....."};
String stated[]={"....."};
private ArrayList<String> list_places = new ArrayList<String>();
Private ArrayAdapter<String> list_adapter;
list_adapter = new ArrayAdapter<String>(this,android.R.layout.simple_expandable_list_item_1,list_places);
for(int i=0;i<10;i++)
{
if(isCity())
/*Text in blue*/
list_adapter.add(cities[i]);
else
/*Text in red*/
list_adapter.add(states[i]);
}
setListAdapter(list_adapter);
try this adapter
public class ListColor extends BaseAdapter {
String[] items = { "Hello ", "hi", " how are you" };
Context mContext;
public ListColor(Context c) {
mContext = c;
}
#Override
public int getCount() {
// TODO Auto-generated method stub
return items.length;
}
#Override
public Object getItem(int arg0) {
// TODO Auto-generated method stub
return null;
}
#Override
public long getItemId(int arg0) {
// TODO Auto-generated method stub
return 0;
}
#Override
public View getView(int arg0, View arg1, ViewGroup arg2) {
// TODO Auto-generated method stub
TextView tv = new TextView(mContext);
tv.setText(items[arg0]);
tv.setTextColor(Color.RED);
return tv;
}
}
i try to build a ExpandableListView with a own ExpandableListAdapter but the ExpandableListView is not visible in my activity :-(
Below you find my Source-Code.
Thanks for your help :-)
Greetings,
Kangee
Here the Code from the activity:
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.group_main);
onCreateDBAndDBTabled();
mAddGroupButton = (Button) findViewById(R.id.Button_Add_Group);
mAddGroupButton.setOnClickListener(this);
mExpandableList = (ExpandableListView) findViewById(R.id.ExpandableListView01);
ArrayList<ExpandableListItem> valueTree = new ArrayList<ExpandableListItem>();
ExpandableListItem gp1 = new ExpandableListItem();
gp1.putProperty("name", "e");
ExpandableListItem gp11 = new ExpandableListItem();
gp11.putProperty("name", "l");
gp1.addChild(gp11);
ExpandableListItem gp2 = new ExpandableListItem();
gp2.putProperty("name", "A");
ExpandableListItem gp22 = new ExpandableListItem();
gp22.putProperty("name", "B");
ExpandableListItem gp23 = new ExpandableListItem();
gp23.putProperty("name", "A1");
ExpandableListItem gp24 = new ExpandableListItem();
gp24.putProperty("name", "A3");
ExpandableListItem gp25 = new ExpandableListItem();
gp25.putProperty("name", "A4");
gp2.addChild(gp22);
gp2.addChild(gp23);
gp2.addChild(gp24);
gp2.addChild(gp25);
valueTree.add(gp1);
valueTree.add(gp2);
Log.d("onCreate", "hasChild " + gp1.hasChilds());
Log.d("onCreate", "hasChild " + gp2.hasChilds());
MyColoredExpandableListAdapter adapter = new MyColoredExpandableListAdapter(this, valueTree);
mExpandableList.setAdapter(adapter);
}
Code MyColoredExpandableListAdapter:
private class MyColoredExpandableListAdapter extends MyExpandableListAdapter{
public MyColoredExpandableListAdapter(Context context,
ArrayList<ExpandableListItem> valueTree) {
super(context, valueTree);
Log.d("MyColoredExpandableListAdapter", "Group Count" + this.getGroupCount());
for(int i = 0; i < this.getGroupCount(); i++)
Log.d("MyColoredExpandableListAdapter", "Child Count" + this.getChildrenCount(i));
// TODO Auto-generated constructor stub
}
public View getChildView(int groupPosition, int childPosition,
boolean isLastChild, View convertView, ViewGroup parent) {
// TODO Auto-generated method stub
Log.d("getChildView", "GO INTO");
if(convertView == null){
LayoutInflater inflater = LayoutInflater.from(mContext);
convertView = inflater.inflate(R.layout.group_exp_childs, null);
}
TextView text = (TextView) convertView.findViewById(R.id.TextView_Group_EXP_Childs);
text.setText(">>" + this.mValueTree.get(groupPosition).getChild(childPosition).getProperty("name"));
return convertView;
}
public View getGroupView(int groupPosition, boolean isExpanded,
View convertView, ViewGroup parent) {
// TODO Auto-generated method stub
Log.d("getGroupView", "GO INTO");
if(convertView == null){
LayoutInflater inflater = LayoutInflater.from(mContext);
convertView = inflater.inflate(R.layout.group_exp_childs, null);
}
TextView text = (TextView) convertView.findViewById(R.id.TextView_Group_EXP_Childs);
text.setText(">" + this.mValueTree.get(groupPosition).getProperty("name"));
return convertView;
}
}
Code MyExpandableListAdapter:
public abstract class MyExpandableListAdapter extends BaseExpandableListAdapter {
protected Context mContext;
protected ArrayList<ExpandableListItem> mValueTree;
public MyExpandableListAdapter(Context context,
ArrayList<ExpandableListItem> valueTree)
{
mContext = context;
mValueTree = valueTree;
}
public Object getChild(int groupPosition, int childPosition) {
// TODO Auto-generated method stub
if(mValueTree.get(groupPosition).hasChilds())
return mValueTree.get(groupPosition).getChild(childPosition);
return null;
}
public long getChildId(int groupPosition, int childPosition) {
// TODO Auto-generated method stub
return childPosition; // WE NEED NO SPECIAL ID
}
public int getChildrenCount(int groupPosition) {
// TODO Auto-generated method stub
if(mValueTree.get(groupPosition).hasChilds())
return mValueTree.get(groupPosition).sizeOfChilds();
return 0;
}
public Object getGroup(int groupPosition) {
// TODO Auto-generated method stub
return mValueTree.get(groupPosition);
}
public int getGroupCount() {
// TODO Auto-generated method stub
return mValueTree.size();
}
public long getGroupId(int groupPosition) {
// TODO Auto-generated method stub
return groupPosition; // WE NEED NO SPECIAL ID
}
public boolean hasStableIds() {
// TODO Auto-generated method stub
return false;
}
public boolean isChildSelectable(int groupPosition, int childPosition) {
// TODO Auto-generated method stub
return true;
}
}
Code ExpandableListItem:
public class ExpandableListItem {
private HashMap<String,String> properties = new HashMap<String,String>();
public void clearProperties() {
properties.clear();
}
public boolean containsPropertyKey(String key) {
return properties.containsKey(key);
}
public boolean containsPropertyValue(String value) {
return properties.containsValue(value);
}
public String getProperty(String key) {
return properties.get(key);
}
public boolean hasProperties() {
return !properties.isEmpty();
}
public String putProperty(String key, String value) {
return properties.put(key, value);
}
public String removeProperty(String key) {
return properties.remove(key);
}
public int sizeOfProperties() {
return properties.size();
}
public String[] propertiesKeys()
{
int count = 0;
String[] result = new String[sizeOfProperties()];
for(String key : this.properties.keySet())
result[count++] = key;
return result;
}
private ArrayList<ExpandableListItem> childs = new ArrayList<ExpandableListItem>();
public boolean addChild(ExpandableListItem object) {
return childs.add(object);
}
public void clearChilds() {
childs.clear();
}
public ExpandableListItem getChild(int index) {
return childs.get(index);
}
public boolean hasChilds() {
return !childs.isEmpty();
}
public ExpandableListItem removeChild(int index) {
return childs.remove(index);
}
public int sizeOfChilds() {
return childs.size();
}
}
The Code of the Layouts (Without Tag):
R.id.TextView_Group_EXP_Childs :
?xml version="1.0" encoding="utf-8"?
LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:paddingLeft="20dp" android:id="#+id/TextView_Group_EXP_Childs" android:text=">>"/TextView
/LinearLayout