Leonitin Sandilya Reign Leonitin Sandilya Reign - 1 month ago 22
Android Question

On Navigation Drawer item click Popup Window

enter image description here

I want to develop a navigation drawer and

onNavItemClick
i want to show a popup window attached to particullar nav Item (nav drawer must remain open)
If anyone has implemented this please provide a link.

Here is my code snippet.

@Override
public void onNavigationDrawerItemSelected(int position) {

switch(position)
{

case 0:
mTitle = getString(R.string.history);
fragment_ride_history = new ListView(this);
popupWindow = new PopupWindow(
fragment_ride_history,
ViewGroup.LayoutParams.WRAP_CONTENT,
ViewGroup.LayoutParams.WRAP_CONTENT);
popupWindow.setOutsideTouchable(true);
popupWindow.setFocusable(true);
popupWindow.setBackgroundDrawable(newBitmapDrawable());
popupWindow.showAtLocation(new LinearLayout(this), Gravity.END, 10, 10);
popupWindow.update(50, 50, 1500, 900);
popupWindow.setContentView(fragment_ride_history);
// this is to call webservice and append the data on listview
getData(1);
fragment_ride_history.setOnScrollListener(new
break;
}
}

Answer

There is no problem for display "popupWindow" on "onNavigationDrawerItemSelected"

I think the problem on "setBackgroundDrawable" because your code work with me i just remove setBackgroundDrawable and I added

fragment_ride_history.setBackgroundColor

test if first without call webservice

for webservice try to call it from AsyncTask or you can use volley lib and show popupwindow at response of call to dont display empty listview.