-SOLVED-

longclickenabled="false" was set in XML.

removed that at it's working

On 17 Jun., 12:40, polzifer <[email protected]> wrote:
> i wanted to add the the longclick is starting the contextmenue and
> working.
>
> On 17 Jun., 12:11, polzifer <[email protected]> wrote:
>
> > I need a solution how to get the OnChildClick working for my
> > ExpanableListActivity.
>
> > when starting of this project the Listener was working, but now i get
> > nothing out of it?
>
> > i tried setting the listener through:
>
> > "getExpandableListView().setOnChildClickListener(this);"
> > at several point, but it isn't responding.
>
> > Here's the source code:
>
> > import java.util.ArrayList;
> > import java.util.HashMap;
> > import java.util.List;
>
> > import android.app.Dialog;
> > import android.app.NotificationManager;
> > import android.app.ProgressDialog;
> > import android.content.ComponentName;
> > import android.content.Intent;
> > import android.content.ServiceConnection;
> > import android.net.Uri;
> > import android.os.Bundle;
> > import android.os.Handler;
> > import android.os.IBinder;
> > import android.os.RemoteException;
> > import android.util.Log;
> > import android.view.ContextMenu;
> > import android.view.Menu;
> > import android.view.MenuInflater;
> > import android.view.MenuItem;
> > import android.view.View;
> > import android.widget.ExpandableListView;
> > import
> > android.widget.ExpandableListView.ExpandableListContextMenuInfo;
> > import de.hdmstuttgart.yaxim.IXMPPUiCallback.Stub;
> > import de.hdmstuttgart.yaxim.data.RosterItem;
> > import de.hdmstuttgart.yaxim.dialogs.AddRosterItemDialog;
> > import de.hdmstuttgart.yaxim.dialogs.ChangeStatusDialog;
> > import de.hdmstuttgart.yaxim.dialogs.MoveRosterItemToGroupDialog;
> > import de.hdmstuttgart.yaxim.dialogs.RemoveRosterItemDialog;
> > import de.hdmstuttgart.yaxim.dialogs.RenameRosterGroupDialog;
> > import de.hdmstuttgart.yaxim.dialogs.RenameRosterItemDialog;
> > import de.hdmstuttgart.yaxim.preferences.AccountPrefs;
> > import de.hdmstuttgart.yaxim.preferences.MainPrefs;
> > import de.hdmstuttgart.yaxim.service.XMPPService;
> > import de.hdmstuttgart.yaxim.util.AdapterConstants;
> > import de.hdmstuttgart.yaxim.util.ExpandableRosterAdapter;
>
> > public class MainWindow extends GenericExpandableListActivity {
>
> >         private static final int CONNECT = Menu.FIRST + 1;
> >         private static final int ADD_FRIEND = Menu.FIRST + 2;
> >         private static final int SHOW_HIDE = Menu.FIRST + 3;
> >         private static final int STATUS = Menu.FIRST + 4;
> >         private static final int EXIT = Menu.FIRST + 5;
> >         private static final int SETTINGS = Menu.FIRST + 6;
> >         private static final int ACC_SET = Menu.FIRST + 7;
>
> >         private static final int NOTIFY_ID = 0;
> >         private static final String TAG = "MainWindow";
> >         private static final int DIALOG_CONNECTING = 1;
>
> >         private Intent xmppServiceIntent;
> >         private ServiceConnection xmppServiceConnection;
> >         private NotificationManager notificationMGR;
> >         private XMPPServiceAdapter serviceAdapter;
> >         private Stub uiCallback;
> >         private List<ArrayList<HashMap<String, RosterItem>>> 
> > rosterEntryList;
> >         private List<HashMap<String, String>> rosterGroupList;
> >         private ExpandableRosterAdapter rosterListAdapter;
> >         private Handler mainHandler;
> >         private ProgressDialog progressDialog;
>
> >         @Override
> >         public void onCreate(Bundle savedInstanceState) {
> >                 super.onCreate(savedInstanceState);
> >                 mainHandler = new Handler();
> >                 rosterEntryList = new ArrayList<ArrayList<HashMap<String,
> > RosterItem>>>();
> >                 rosterGroupList = new ArrayList<HashMap<String, String>>();
>
> >                 registerXMPPService();
> >                 createUICallback();
> >                 setContentView(R.layout.main);
> >                 setNotificationManager();
> >                 registerForContextMenu(getExpandableListView());
> >         }
>
> >         @Override
> >         protected void onPause() {
> >                 super.onPause();
> >                 serviceAdapter.unregisterUICallback(uiCallback);
> >                 unbindXMPPService();
> >         }
>
> >         @Override
> >         protected void onResume() {
> >                 super.onResume();
> >                 notificationMGR.cancel(NOTIFY_ID);
> >                 bindXMPPService();
> >         }
>
> >         private void createRosterIfConnected() {
> >                 if ((serviceAdapter != null)
> >                                 && 
> > (serviceAdapter.isServiceAuthenticated())) {
> >                         createRoster();
> >                 }
> >         }
>
> >         public void updateRoster() {
> >                 if (serviceAdapter.isAuthenticated()
> >                                 && getExpandableListAdapter() != null) {
> >                         rosterEntryList.clear();
> >                         createRosterEntryList();
> >                         rosterGroupList.clear();
> >                         createRosterGroupList();
> >                         rosterListAdapter.notifyDataSetChanged();
> >                 }
> >         }
>
> >         @Override
> >         public void onCreateContextMenu(ContextMenu menu, View v,
> >                         ContextMenu.ContextMenuInfo menuInfo) {
> >                 ExpandableListView.ExpandableListContextMenuInfo info;
>
> >                 try {
> >                         info = 
> > (ExpandableListView.ExpandableListContextMenuInfo) menuInfo;
> >                 } catch (ClassCastException e) {
> >                         Log.e(TAG, "bad menuinfo: ", e);
> >                         return;
> >                 }
>
> >                 long packedPosition = info.packedPosition;
> >                 boolean isChild = isChild(packedPosition);
>
> >                 MenuInflater inflater = getMenuInflater();
> >                 inflater.inflate(R.menu.roster_menue, menu);
>
> >                 int groupPosition = ExpandableListView
> >                                 
> > .getPackedPositionGroup(info.packedPosition);
> >                 String groupName = 
> > rosterEntryList.get(groupPosition).get(0).get(
> >                                 AdapterConstants.CONTACT_ID).getGroup();
>
> >                 if (isChild) {
> >                         menu.setGroupVisible(R.id.roster_contacts_group, 
> > true);
> >                         menu.setGroupVisible(R.id.roster_groups_group, 
> > false);
> >                         
> > menu.setHeaderTitle(R.string.MenuContext_ContactHeaderTitle);
> >                 } else {
> >                         if (groupName.equals(AdapterConstants.EMPTY_GROUP)) 
> > {
> >                                 
> > menu.setGroupVisible(R.id.roster_contacts_group, false);
> >                                 
> > menu.setGroupVisible(R.id.roster_groups_group, false);
> >                                 
> > menu.setHeaderTitle(R.string.MenuContext_HeaderTitleDisabled);
> >                         } else {
> >                                 
> > menu.setGroupVisible(R.id.roster_contacts_group, false);
> >                                 
> > menu.setGroupVisible(R.id.roster_groups_group, true);
> >                                 
> > menu.setHeaderTitle(R.string.MenuContext_GroupsHeaderTitle);
> >                         }
> >                 }
> >         }
>
> >         @Override
> >         public boolean onContextItemSelected(MenuItem item) {
> >                 return applyMenuContextChoice(item);
> >         }
>
> >         private boolean applyMenuContextChoice(MenuItem item) {
>
> >                 ExpandableListContextMenuInfo contextMenuInfo =
> > (ExpandableListContextMenuInfo) item
> >                                 .getMenuInfo();
> >                 int groupPosition = ExpandableListView
> >                                 
> > .getPackedPositionGroup(contextMenuInfo.packedPosition);
> >                 int childPosition = ExpandableListView
> >                                 
> > .getPackedPositionChild(contextMenuInfo.packedPosition);
>
> >                 if (isChild(contextMenuInfo.packedPosition)) {
>
> >                         String user = 
> > rosterEntryList.get(groupPosition).get(childPosition)
> >                                         
> > .get(AdapterConstants.CONTACT_ID).getJabberID();
>
> >                         int itemID = item.getItemId();
>
> >                         switch (itemID) {
> >                         case R.id.roster_openchat:
> >                                 startChatActivity(user);
>
> >                                 return true;
> >                         case R.id.roster_delete_contact:
> >                                 RemoveRosterItemDialog deleteRosterItem = 
> > new
> > RemoveRosterItemDialog(
> >                                                 this, serviceAdapter, user);
> >                                 deleteRosterItem.show();
> >                                 return true;
> >                         case R.id.roster_rename_contact:
> >                                 new
>
> ...
>
> Erfahren Sie mehr »
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to