import android.view.View;
import android.widget.*;
+//TODO if i want to add a new event after i edit one the fields are being filled with the last event data
+
public final class AddEventActivity extends Activity implements OnDateSetListener, OnTimeSetListener{
private TextView dateTimeTextView;
private static Event tempEvent=new Event();
final ActionBar.Tab t2 = actionBar.newTab().setText(this.getString(R.string.addevtab2));
final ActionBar.Tab t3 = actionBar.newTab().setText(this.getString(R.string.addevtab3));
- f1 = new TrivialFragment(tempEvent);
+ f1 = new TrivialFragment();
final Bundle b1=new Bundle();
b1.putInt(TrivialFragment.ARGUMENT_LAYOUT, R.layout.add_event_basic_tab);
+ b1.putParcelable(TrivialFragment.ARGUMENT_EVENT,tempEvent);
f1.setArguments(b1);
- f2 = new TrivialFragment(tempEvent);
+ f2 = new TrivialFragment();
final Bundle b2=new Bundle();
b2.putInt(TrivialFragment.ARGUMENT_LAYOUT, R.layout.add_event_details_tab);
+ b2.putParcelable(TrivialFragment.ARGUMENT_EVENT,tempEvent);
f2.setArguments(b2);
- f3 = new TrivialFragment(tempEvent);
+ f3 = new TrivialFragment();
final Bundle b3=new Bundle();
b3.putInt(TrivialFragment.ARGUMENT_LAYOUT, R.layout.add_event_other_tab);
+ b3.putParcelable(TrivialFragment.ARGUMENT_EVENT,tempEvent);
f3.setArguments(b3);
t1.setTabListener(new AddEventTabListener(f1,tempEvent,0));
public final class TrivialFragment extends Fragment {
Event ev;
- public TrivialFragment(Event e) {
- ev=e;
- }
+ public static final String ARGUMENT_EVENT= "Event";
@Override
public void onActivityCreated (Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
+ ev=getArguments().getParcelable(ARGUMENT_EVENT);
switch (getArguments().getInt(ARGUMENT_LAYOUT)) {
case R.layout.add_event_basic_tab:
EditText title = (EditText) getView().findViewById(R.id.eventtitle);