SlideShare une entreprise Scribd logo
1  sur  4
Télécharger pour lire hors ligne
݇†ó£Œ®™ ðô Mî ªêò™èÀœ
º‚Aòñ£ù¶ Lv† (List) à¼õ£‚°
õ‹. Þ‰î ð°FJ™ Simple Expandable List
âŠð® à¼õ£‚èô£‹ â¡ð¬î 𣘊«ð£‹.
݇†ó£Œ´ Šó£ªü‚†®¬ù à¼õ£‚è
â‚OŠC¬ù ðò¡ð´ˆ¶ƒèœ. â‚OŠC¬ù»‹
݇†ó£Œ´ âv®«èJ¬ù»‹ Þ¬íò
î÷ˆFL¼‰¶ Þôõêñ£è ðFMø‚è‹ ªêŒ¶
ªè£œ÷ô£‹.
꣡ÁèÀ‚°Þƒ«è݇†ó£Œ´âv®«è
4.0 ðò¡ð´ˆF»œ«÷¡. â‚OŠC™ ¹Fò
ÜŠO«èê¡ à¼õ£‚è File>New>Android Pro
ject â¡Á ªî£ìƒA, ÜŠO«èê¡ ªðòK¬ù
Simple Expandable List Example âù ªðò
K´ƒèœ.
Ý‚®M†®J™ «î¬õò£ù Gó™è¬÷
â¿Fì Simple Expandablelist Example Acti
vity.Java â¡ø ç¬ðL¬ù Þó†¬ì AO‚
package ram.com.example;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import android.app.ExpandableListActivity;
import android.os.Bundle;
import android.widget.ExpandableListAdapter;
import
android.widget.SimpleExpandableListAdapter;
public class
SimpleExpandableListExampleActivity extends
ExpandableListActivity {
private static final String NAME = "NAME";
private static final String IS_EVEN =
"IS_EVEN";
private ExpandableListAdapter mAdapter;
@Override
public void onCreate(Bundle
savedInstanceState) {
super.onCreate(savedInstanceState);
List<Map<String, String>> groupData =
new ArrayList<Map<String, String>>();
List<List<Map<String, String>>>
childData = new ArrayList<List<Map<String,
String>>>();
for (int i = 0; i < 20; i++) {
Map<String, String> curGroupMap =
new HashMap<String, String>();
groupData.add(curGroupMap);
curGroupMap.put(NAME, "Item " + i);
curGroupMap.put(IS_EVEN, (i % 2 ==
0) ? "This group is even" : "This group is
odd"); Gó™ -1
ðì‹-1
List<Map<String, String>> children =
new ArrayList<Map<String, String>>();
for (int j = 0; j < 5; j++) {
Map<String, String> curChildMap =
new HashMap<String, String>();
children.add(curChildMap);
// curChildMap.put(NAME, "Child " +
j);
curChildMap.put(IS_EVEN, (j % 2
== 0) ? "Hello " + j: "Good Morning "+ j);
}
childData.add(children);
}
// Set up our adapter
mAdapter = new
SimpleExpandableListAdapter(
this,
groupData,
android.R.layout.simple_expandable_list_item
_1,
new String[] { NAME, IS_EVEN },
new int[] { android.R.id.text1,
android.R.id.text2 },
childData,
android.R.layout.simple_expandable_list_item
_2,
new String[] { NAME, IS_EVEN },
new int[] { android.R.id.text1,
android.R.id.text2 }
);
setListAdapter(mAdapter);
}
݇†ó£Œ®™ Lv†
à¼õ£‚°õ¶ âŠð®?
Ý¡†ó£Œ´ -2
Þ󣋰ñ£˜ ªô†²Iï£ó£òí¡
19
ªêŒ»ƒèœ. Gó™-1™
ªè£´‚èŠð†´œ
֦.
Þ‰î Lv†®¡
ܬñŠH¡ Itemâ¡
ðî¬ù AO‚ ªêŒî
¾ì¡ Hello>Good
M o r n i n g > H e l l o 2 >
Good Morning3> Hello
4 â¡Á‹ Item AO‚
ªêŒî¾ì¡ Hello>
Good Morning1 >Hello
2>Good Morning3>
Hello 4 â¡Á Item
1-™ Þ¼‰¶ 19 õ¬ó
àœ÷ â‰î Item
AO‚ ªêŒî£½‹ Lv† à¼õ£°õ Þ‰î
Gó™ ðò¡ð´Aø¶.
Þ‰î GóL™ Array List, Hash Map ñŸÁ‹
List ðò¡ð´ˆîŠð†´œ÷¶. Þî¬ù îMó
ExpandableListAdapter ñŸÁ‹ SimpleExpan
dable List Adapter ðò¡ð´ˆîŠð†´œ÷¶.
ªð¼‹ð£ô£ù ÜŠO«èê¡èO™ A÷£v
Ýù¶ Ý‚®M†®J¬ù«ò Extend ªêŒòŠ
ð†®¼‚°‹. Þ‰î GóL™ Expandable List
Activity - ä Extend ªêŒ¶œ«÷£‹.
Adapter â¡ø ñ£PL Íô‹ List Adapter
«î£¡P»œ÷ ñFŠ¹èœ ܬñ‰¶œ÷ù.
ðì‹ 1 MKõ¬ìò£î Lv†®¬ù F¬óJ™
裆ìŠð†´œ÷¶. ðì‹ 2 ñŸÁ‹ 3 MK‰î
Lv†¬ì F¬óJ™ 裆ìŠð†´œ÷¶.
Ü´ˆî ꣡ø£è Custom Expandable List
à¼õ£‚°õ¬î 𣘊«ð£‹. ¹Fò Šó£
ªü‚†¬ì à¼õ£‚A Üî¡ ªðò¬ó Custom
Expandable List â¡Á ªè£´ƒèœ. Import ðò¡
ð´ˆF android.view ñŸÁ‹ android.wid get -ä
ðò¡ð´ˆ¶ñ£Á GóL¬ù ܬñ‚è «õ‡
´‹.
CustomExpandabl
eList A֣v Ex
pandable List Activity
Íô‹ Extend ªêŒ»
ñ£Áܬñ‚è«õ‡
´‹. my Expand List
Adapterâ¡ø A÷£v
C¬ù à¼õ£‚°‹
F¬óJ™ «î£¡Á
õîŸè£ù îèõ™èœ
Þ¼‚è «õ‡´‹.
꣡ø£è groups ñŸ
Á‹ Children.
Þî¬ù F¬óJ™
ܬñ»‹ º¬ø ñŸ
Á‹ ⃰ «î£¡ø
ðì‹-2
ðì‹-3
ðì‹-4
ðì‹-5
ðì‹-6
int groupPos =
ExpandableListView.getPackedPositionGroup(inf
o.packedPosition);
int childPos =
ExpandableListView.getPackedPositionChild(info
.packedPosition);
Toast.makeText(this, title + ": Child "
+ childPos + " clicked in group " + groupPos,
Toast.LENGTH_SHORT).show();
return true;
} else if (type ==
ExpandableListView.PACKED_POSITION_TYPE_
GROUP) {
int groupPos =
ExpandableListView.getPackedPositionGroup(inf
o.packedPosition);
Toast.makeText(this, title + ": Group "
+ groupPos + " clicked",
Toast.LENGTH_SHORT).show();
return true;
}
return false;
}
public class MyExpandableListAdapter
extends BaseExpandableListAdapter {
private String[] groups = { "Android
Versions", "Android Phones" };
private String[][] children = {
{ "IceCream Sandwitch",
"Gingerboard", "Android 2.0", "Android 1.6" },
{ "Razr", "Sony Ericsson", "Galaxy
Tab", "Galaxy" }
};
public Object getChild(int groupPosition,
int childPosition) {
return
children[groupPosition][childPosition];
}
public long getChildId(int groupPosition,
int childPosition) {
return childPosition;
}
public int getChildrenCount(int
groupPosition) {
return children[groupPosition].length;
}
public TextView getGenericView() {
AbsListView.LayoutParams lp = new
AbsListView.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT, 64);
TextView textView = new
TextView(CustomExpandableList.this);
textView.setLayoutParams(lp);
package ram.com.CustomExpandableList;
import android.app.ExpandableListActivity;
import android.os.Bundle;
import android.view.ContextMenu;
import
android.view.ContextMenu.ContextMenuInfo;
import android.view.Gravity;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AbsListView;
import
android.widget.BaseExpandableListAdapter;
import android.widget.ExpandableListAdapter;
import android.widget.ExpandableListView;
import
android.widget.ExpandableListView.Expandabl
eListContextMenuInfo;
import android.widget.TextView;
import android.widget.Toast;
public class CustomExpandableList extends
ExpandableListActivity {
ExpandableListAdapter mAdapter;
@Override
public void onCreate(Bundle
savedInstanceState) {
super.onCreate(savedInstanceState);
// Set up our adapter
mAdapter = new
MyExpandableListAdapter();
setListAdapter(mAdapter);
registerForContextMenu(getExpandableListVie
w());
}
@Override
public void
onCreateContextMenu(ContextMenu menu,
View v, ContextMenuInfo menuInfo) {
menu.setHeaderTitle("Sample menu");
menu.add(0, 0, 0, "Sample action");
}
@Override
public boolean
onContextItemSelected(MenuItem item) {
ExpandableListContextMenuInfo info =
(ExpandableListContextMenuInfo)
item.getMenuInfo();
String title = ((TextView)
info.targetView).getText().toString();
int type =
ExpandableListView.getPackedPositionType(inf
o.packedPosition);
if (type ==
ExpandableListView.PACKED_POSITION_TYPE
_CHILD) {
textView.setGravity(Gravity.CENTER_VERTI
CAL | Gravity.LEFT);
textView.setPadding(36, 0, 0, 0);
return textView;
}
public View getChildView(int
groupPosition, int childPosition, boolean
isLastChild,
View convertView, ViewGroup
parent) {
TextView textView =
getGenericView();
textView.setText(getChild(groupPosition,
childPosition).toString());
return textView;
}
public Object getGroup(int
groupPosition) {
return groups[groupPosition];
}
public int getGroupCount() {
return groups.length;
}
public long getGroupId(int groupPosition)
{
return groupPosition;
}
public View getGroupView(int
groupPosition, boolean isExpanded, View
convertView,
ViewGroup parent) {
TextView textView = getGenericView();
textView.setText(getGroup(groupPosition).toStr
ing());
return textView;
}
public boolean isChildSelectable(int
groupPosition, int childPosition) {
return true;
}
public boolean hasStableIds() {
return true;
}
}
}
- ªî£ì¼‹
Gó™-2
ðì‹-7 ðì‹-8
ðì‹-9
«õ‡´‹ â¡ðî¬ù»‹
GóL™ °PŠHì «õ‡
´‹. ÞîŸè£ù Gó™ -2™
àœ÷¶. (ðì‹-4) Lv†
âšõ£Á«î£¡Á‹â¡Á
F¬óJ™ 裆ìŠð†´œ
÷¶. ðì‹-5™ «î˜‰ªî
´ˆî Lv†®¡
ܬñŠ¹ 裆ìŠð†´œ
֦.
ðì‹-6™ Lv†®¬ù
«î˜‰ªî´ˆî¾ì¡ MK
õ¬ì‰î ªêò™ F¬óJ™
裇H‚èŠð†´œ÷¶.
«î˜¾ ªêŒ¶ 衆
«ó£™ AO‚ ªêŒî£™
ðì‹7 «ð£¡ø F¬ó
«î£¡Á‹. ªñÂM™ «î˜‰
ªî´‚°‹ º¬øJ¬ù
ðì‹-8™ 裇H‚èŠð†
´œ÷¶.
«î˜¾ ªêŒî Lv†
®Ÿ° ãŸð îèõ™ toast
ðò¡ð´ˆFù£™ ðì‹-9™
àœ÷¶ «ð£¡Á «î£¡
Á‹.

Contenu connexe

Tendances (17)

Part 7
Part 7Part 7
Part 7
 
SQLite in Android App (in tamil)
SQLite in Android App (in tamil)SQLite in Android App (in tamil)
SQLite in Android App (in tamil)
 
Rating Bar in Android Example
Rating Bar in Android ExampleRating Bar in Android Example
Rating Bar in Android Example
 
Creating Image Gallery - Android app (in tamil)
Creating Image Gallery - Android app (in tamil)Creating Image Gallery - Android app (in tamil)
Creating Image Gallery - Android app (in tamil)
 
Water tamil
Water tamilWater tamil
Water tamil
 
Top Ten SE Concepts V11.1 Jp
Top Ten SE Concepts V11.1 JpTop Ten SE Concepts V11.1 Jp
Top Ten SE Concepts V11.1 Jp
 
Programming言語Lua紹介(Internet版)
Programming言語Lua紹介(Internet版)Programming言語Lua紹介(Internet版)
Programming言語Lua紹介(Internet版)
 
Sentinel Hardware Keys
Sentinel Hardware KeysSentinel Hardware Keys
Sentinel Hardware Keys
 
구글을 지탱하는 기술
구글을 지탱하는 기술구글을 지탱하는 기술
구글을 지탱하는 기술
 
Bhale chance
Bhale chanceBhale chance
Bhale chance
 
Le Illusioni Di Octavio Ocampo
Le Illusioni Di Octavio OcampoLe Illusioni Di Octavio Ocampo
Le Illusioni Di Octavio Ocampo
 
Green Leaps - Chinese
Green Leaps - ChineseGreen Leaps - Chinese
Green Leaps - Chinese
 
최종Google3
최종Google3최종Google3
최종Google3
 
최종 Google3
최종 Google3최종 Google3
최종 Google3
 
Digital contents -midterm-
Digital contents -midterm-Digital contents -midterm-
Digital contents -midterm-
 
Capitulo 27 - Corriente y Resistencia
Capitulo 27 - Corriente y ResistenciaCapitulo 27 - Corriente y Resistencia
Capitulo 27 - Corriente y Resistencia
 
CEO-016-領導02
CEO-016-領導02CEO-016-領導02
CEO-016-領導02
 

Plus de Dr. Ramkumar Lakshminarayanan

Plus de Dr. Ramkumar Lakshminarayanan (18)

IT security awareness
IT security awarenessIT security awareness
IT security awareness
 
Basics of IT security
Basics of IT securityBasics of IT security
Basics of IT security
 
IT Security Awareness Posters
IT Security Awareness PostersIT Security Awareness Posters
IT Security Awareness Posters
 
Normalisation revision
Normalisation revisionNormalisation revision
Normalisation revision
 
Windows mobile programming
Windows mobile programmingWindows mobile programming
Windows mobile programming
 
Concurrency control
Concurrency controlConcurrency control
Concurrency control
 
Web technology today
Web technology todayWeb technology today
Web technology today
 
Php Tutorial
Php TutorialPhp Tutorial
Php Tutorial
 
Phonegap for Android
Phonegap for AndroidPhonegap for Android
Phonegap for Android
 
Android app - Creating Live Wallpaper (tamil)
Android app - Creating Live Wallpaper (tamil)Android app - Creating Live Wallpaper (tamil)
Android app - Creating Live Wallpaper (tamil)
 
Android Animation (in tamil)
Android Animation (in tamil)Android Animation (in tamil)
Android Animation (in tamil)
 
Single Touch event view in Android (in tamil)
Single Touch event view in Android (in tamil)Single Touch event view in Android (in tamil)
Single Touch event view in Android (in tamil)
 
Android Application using seekbar (in tamil)
Android Application using seekbar (in tamil)Android Application using seekbar (in tamil)
Android Application using seekbar (in tamil)
 
GPS in Android (in tamil)
GPS in Android (in tamil)GPS in Android (in tamil)
GPS in Android (in tamil)
 
Shared Preference in Android App
Shared Preference in Android AppShared Preference in Android App
Shared Preference in Android App
 
Data Storage in Android App
Data Storage in Android AppData Storage in Android App
Data Storage in Android App
 
Notification in Android App (in tamil)
Notification in Android App (in tamil)Notification in Android App (in tamil)
Notification in Android App (in tamil)
 
Layout Object in Android App
Layout Object in Android AppLayout Object in Android App
Layout Object in Android App
 

Creating List in Android App (in tamil)

  • 1. ݇†ó£Œ®™ ðô Mî ªêò™èÀœ º‚Aòñ£ù¶ Lv† (List) à¼õ£‚° õ‹. Þ‰î ð°FJ™ Simple Expandable List âŠð® à¼õ£‚èô£‹ â¡ð¬î 𣘊«ð£‹. ݇†ó£Œ´ Šó£ªü‚†®¬ù à¼õ£‚è â‚OŠC¬ù ðò¡ð´ˆ¶ƒèœ. â‚OŠC¬ù»‹ ݇†ó£Œ´ âv®«èJ¬ù»‹ Þ¬íò î÷ˆFL¼‰¶ Þôõêñ£è ðFMø‚è‹ ªêŒ¶ ªè£œ÷ô£‹. ꣡ÁèÀ‚°Þƒ«è݇†ó£Œ´âv®«è 4.0 ðò¡ð´ˆF»œ«÷¡. â‚OŠC™ ¹Fò ÜŠO«èê¡ à¼õ£‚è File>New>Android Pro ject â¡Á ªî£ìƒA, ÜŠO«èê¡ ªðòK¬ù Simple Expandable List Example âù ªðò K´ƒèœ. Ý‚®M†®J™ «î¬õò£ù Gó™è¬÷ â¿Fì Simple Expandablelist Example Acti vity.Java â¡ø ç¬ðL¬ù Þó†¬ì AO‚ package ram.com.example; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import android.app.ExpandableListActivity; import android.os.Bundle; import android.widget.ExpandableListAdapter; import android.widget.SimpleExpandableListAdapter; public class SimpleExpandableListExampleActivity extends ExpandableListActivity { private static final String NAME = "NAME"; private static final String IS_EVEN = "IS_EVEN"; private ExpandableListAdapter mAdapter; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); List<Map<String, String>> groupData = new ArrayList<Map<String, String>>(); List<List<Map<String, String>>> childData = new ArrayList<List<Map<String, String>>>(); for (int i = 0; i < 20; i++) { Map<String, String> curGroupMap = new HashMap<String, String>(); groupData.add(curGroupMap); curGroupMap.put(NAME, "Item " + i); curGroupMap.put(IS_EVEN, (i % 2 == 0) ? "This group is even" : "This group is odd"); Gó™ -1 ðì‹-1 List<Map<String, String>> children = new ArrayList<Map<String, String>>(); for (int j = 0; j < 5; j++) { Map<String, String> curChildMap = new HashMap<String, String>(); children.add(curChildMap); // curChildMap.put(NAME, "Child " + j); curChildMap.put(IS_EVEN, (j % 2 == 0) ? "Hello " + j: "Good Morning "+ j); } childData.add(children); } // Set up our adapter mAdapter = new SimpleExpandableListAdapter( this, groupData, android.R.layout.simple_expandable_list_item _1, new String[] { NAME, IS_EVEN }, new int[] { android.R.id.text1, android.R.id.text2 }, childData, android.R.layout.simple_expandable_list_item _2, new String[] { NAME, IS_EVEN }, new int[] { android.R.id.text1, android.R.id.text2 } ); setListAdapter(mAdapter); } ݇†ó£Œ®™ Lv† à¼õ£‚°õ¶ âŠð®?
  • 2. Ý¡†ó£Œ´ -2 Þ󣋰ñ£˜ ªô†²Iï£ó£òí¡ 19 ªêŒ»ƒèœ. Gó™-1™ ªè£´‚èŠð†´œ ÷¶. Þ‰î Lv†®¡ ܬñŠH¡ Itemâ¡ ðî¬ù AO‚ ªêŒî ¾ì¡ Hello>Good M o r n i n g > H e l l o 2 > Good Morning3> Hello 4 â¡Á‹ Item AO‚ ªêŒî¾ì¡ Hello> Good Morning1 >Hello 2>Good Morning3> Hello 4 â¡Á Item 1-™ Þ¼‰¶ 19 õ¬ó àœ÷ â‰î Item AO‚ ªêŒî£½‹ Lv† à¼õ£°õ Þ‰î Gó™ ðò¡ð´Aø¶. Þ‰î GóL™ Array List, Hash Map ñŸÁ‹ List ðò¡ð´ˆîŠð†´œ÷¶. Þî¬ù îMó ExpandableListAdapter ñŸÁ‹ SimpleExpan dable List Adapter ðò¡ð´ˆîŠð†´œ÷¶. ªð¼‹ð£ô£ù ÜŠO«èê¡èO™ A÷£v Ýù¶ Ý‚®M†®J¬ù«ò Extend ªêŒòŠ ð†®¼‚°‹. Þ‰î GóL™ Expandable List Activity - ä Extend ªêŒ¶œ«÷£‹. Adapter â¡ø ñ£PL Íô‹ List Adapter «î£¡P»œ÷ ñFŠ¹èœ ܬñ‰¶œ÷ù. ðì‹ 1 MKõ¬ìò£î Lv†®¬ù F¬óJ™ 裆ìŠð†´œ÷¶. ðì‹ 2 ñŸÁ‹ 3 MK‰î Lv†¬ì F¬óJ™ 裆ìŠð†´œ÷¶. Ü´ˆî ꣡ø£è Custom Expandable List à¼õ£‚°õ¬î 𣘊«ð£‹. ¹Fò Šó£ ªü‚†¬ì à¼õ£‚A Üî¡ ªðò¬ó Custom Expandable List â¡Á ªè£´ƒèœ. Import ðò¡ ð´ˆF android.view ñŸÁ‹ android.wid get -ä ðò¡ð´ˆ¶ñ£Á GóL¬ù ܬñ‚è «õ‡ ´‹. CustomExpandabl eList A÷£v¬ê Ex pandable List Activity Íô‹ Extend ªêŒ» ñ£Áܬñ‚è«õ‡ ´‹. my Expand List Adapterâ¡ø A÷£v C¬ù à¼õ£‚°‹ F¬óJ™ «î£¡Á õîŸè£ù îèõ™èœ Þ¼‚è «õ‡´‹. ꣡ø£è groups ñŸ Á‹ Children. Þî¬ù F¬óJ™ ܬñ»‹ º¬ø ñŸ Á‹ ⃰ «î£¡ø ðì‹-2 ðì‹-3 ðì‹-4 ðì‹-5 ðì‹-6
  • 3. int groupPos = ExpandableListView.getPackedPositionGroup(inf o.packedPosition); int childPos = ExpandableListView.getPackedPositionChild(info .packedPosition); Toast.makeText(this, title + ": Child " + childPos + " clicked in group " + groupPos, Toast.LENGTH_SHORT).show(); return true; } else if (type == ExpandableListView.PACKED_POSITION_TYPE_ GROUP) { int groupPos = ExpandableListView.getPackedPositionGroup(inf o.packedPosition); Toast.makeText(this, title + ": Group " + groupPos + " clicked", Toast.LENGTH_SHORT).show(); return true; } return false; } public class MyExpandableListAdapter extends BaseExpandableListAdapter { private String[] groups = { "Android Versions", "Android Phones" }; private String[][] children = { { "IceCream Sandwitch", "Gingerboard", "Android 2.0", "Android 1.6" }, { "Razr", "Sony Ericsson", "Galaxy Tab", "Galaxy" } }; public Object getChild(int groupPosition, int childPosition) { return children[groupPosition][childPosition]; } public long getChildId(int groupPosition, int childPosition) { return childPosition; } public int getChildrenCount(int groupPosition) { return children[groupPosition].length; } public TextView getGenericView() { AbsListView.LayoutParams lp = new AbsListView.LayoutParams( ViewGroup.LayoutParams.MATCH_PARENT, 64); TextView textView = new TextView(CustomExpandableList.this); textView.setLayoutParams(lp); package ram.com.CustomExpandableList; import android.app.ExpandableListActivity; import android.os.Bundle; import android.view.ContextMenu; import android.view.ContextMenu.ContextMenuInfo; import android.view.Gravity; import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; import android.widget.AbsListView; import android.widget.BaseExpandableListAdapter; import android.widget.ExpandableListAdapter; import android.widget.ExpandableListView; import android.widget.ExpandableListView.Expandabl eListContextMenuInfo; import android.widget.TextView; import android.widget.Toast; public class CustomExpandableList extends ExpandableListActivity { ExpandableListAdapter mAdapter; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // Set up our adapter mAdapter = new MyExpandableListAdapter(); setListAdapter(mAdapter); registerForContextMenu(getExpandableListVie w()); } @Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) { menu.setHeaderTitle("Sample menu"); menu.add(0, 0, 0, "Sample action"); } @Override public boolean onContextItemSelected(MenuItem item) { ExpandableListContextMenuInfo info = (ExpandableListContextMenuInfo) item.getMenuInfo(); String title = ((TextView) info.targetView).getText().toString(); int type = ExpandableListView.getPackedPositionType(inf o.packedPosition); if (type == ExpandableListView.PACKED_POSITION_TYPE _CHILD) {
  • 4. textView.setGravity(Gravity.CENTER_VERTI CAL | Gravity.LEFT); textView.setPadding(36, 0, 0, 0); return textView; } public View getChildView(int groupPosition, int childPosition, boolean isLastChild, View convertView, ViewGroup parent) { TextView textView = getGenericView(); textView.setText(getChild(groupPosition, childPosition).toString()); return textView; } public Object getGroup(int groupPosition) { return groups[groupPosition]; } public int getGroupCount() { return groups.length; } public long getGroupId(int groupPosition) { return groupPosition; } public View getGroupView(int groupPosition, boolean isExpanded, View convertView, ViewGroup parent) { TextView textView = getGenericView(); textView.setText(getGroup(groupPosition).toStr ing()); return textView; } public boolean isChildSelectable(int groupPosition, int childPosition) { return true; } public boolean hasStableIds() { return true; } } } - ªî£ì¼‹ Gó™-2 ðì‹-7 ðì‹-8 ðì‹-9 «õ‡´‹ â¡ðî¬ù»‹ GóL™ °PŠHì «õ‡ ´‹. ÞîŸè£ù Gó™ -2™ àœ÷¶. (ðì‹-4) Lv† âšõ£Á«î£¡Á‹â¡Á F¬óJ™ 裆ìŠð†´œ ÷¶. ðì‹-5™ «î˜‰ªî ´ˆî Lv†®¡ ܬñŠ¹ 裆ìŠð†´œ ÷¶. ðì‹-6™ Lv†®¬ù «î˜‰ªî´ˆî¾ì¡ MK õ¬ì‰î ªêò™ F¬óJ™ 裇H‚èŠð†´œ÷¶. «î˜¾ ªêŒ¶ 衆 «ó£™ AO‚ ªêŒî£™ ðì‹7 «ð£¡ø F¬ó «î£¡Á‹. ªñÂM™ «î˜‰ ªî´‚°‹ º¬øJ¬ù ðì‹-8™ 裇H‚èŠð† ´œ÷¶. «î˜¾ ªêŒî Lv† ®Ÿ° ãŸð îèõ™ toast ðò¡ð´ˆFù£™ ðì‹-9™ àœ÷¶ «ð£¡Á «î£¡ Á‹.