0
   I can't pass data..
      public class CustomerListFragment extends BaseFragment{
      public static Customer selectCustomerEdit;
       }
//when selected in listView for show popup dialog contex
    @Override  //beheh
  public void onCreateContextMenu(ContextMenu menu, View v,ContextMenuInfo menuInfo) {  
    super.onCreateContextMenu(menu, v, menuInfo); 
     menu.setHeaderTitle("Options");  
    menu.add(0, v.getId(), 0, "Edit Customer"); 
    menu.add(0,v.getId(),0,"Cancel");
   AdapterView.AdapterContextMenuInfo info =  (AdapterView.AdapterContextMenuInfo)menuInfo;
  selectCustomerEdit=(Customer)lvCustomers.getItemAtPosition(info.position);

}  ///

@Override  

public boolean onContextItemSelected(MenuItem item) {  
    if(item.getTitle()=="Edit Customer"){customerEdit(); }
    else if(item.getTitle()=="cancel"){return true;}
    else {return false;}  
return true;  
}  

when click customer edit popup dialog context call this mehod.

public void customerEdit(){
    Intent i = new Intent(getActivity(), AddNewCustomerActivity.class);
    i.putExtra("customer", selectCustomerEdit);
      }

/When I declare modifiler AddNewCustomerActivity class i can't pass data show error line getArgument() how i can do?/

    AddNewCustomerActivity extends FragmentActivity{
     public satatic Customer customer=    (Customer)getArguments().getSerializable("customer");
          }
  • 1
    I suggest you go through this http://developer.android.com/training/basics/fragments/communicating.html A best use of delegation pattern for communicatiion b/n fragment and activity – ppuskar Aug 28 '14 at 03:58

1 Answers1

0

You can attach a bundle

   Bundle bundle = new Bundle();
    bundle.putSerializable(Tag,Data);

Also for this the data class has to implement 'Serializable'

ZInj
  • 341
  • 2
  • 9
  • how to get pass from bundle data to AddNewCustomerActivity.class? –  Aug 28 '14 at 06:18
  • Refer Link http://stackoverflow.com/questions/768969/passing-a-bundle-on-startactivity – ZInj Aug 28 '14 at 06:25