From 2a92dcf2c86b48dead81da28ca9a1aaa77e09190 Mon Sep 17 00:00:00 2001 From: Petru Date: Tue, 13 Aug 2013 13:12:06 +0300 Subject: [PATCH] Edit event. work in progress[2] --- src/ro/ieval/unical/AddEventActivity.java | 10 ++++++---- src/ro/ieval/unical/AddEventTabListener.java | 9 +++++++++ 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/src/ro/ieval/unical/AddEventActivity.java b/src/ro/ieval/unical/AddEventActivity.java index 89fe73e..3259093 100644 --- a/src/ro/ieval/unical/AddEventActivity.java +++ b/src/ro/ieval/unical/AddEventActivity.java @@ -18,12 +18,14 @@ import android.widget.*; public final class AddEventActivity extends Activity implements OnDateSetListener, OnTimeSetListener{ private TextView dateTimeTextView; - private Event tempEvent=new Event(); + private static Event tempEvent=new Event(); public static final String EXTRA_EVENT = "event"; + private static Fragment f1,f2,f3; public static void editEvent(final Context c, final Event e) { Intent i = new Intent(c,AddEventActivity.class); i.putExtra(AddEventActivity.EXTRA_EVENT,e); + tempEvent=e; c.startActivity(i); } @@ -39,17 +41,17 @@ public final class AddEventActivity extends Activity implements OnDateSetListene final ActionBar.Tab t2 = actionBar.newTab().setText(this.getString(R.string.addevtab2)); final ActionBar.Tab t3 = actionBar.newTab().setText(this.getString(R.string.addevtab3)); - final Fragment f1 = new TrivialFragment(); + f1 = new TrivialFragment(); final Bundle b1=new Bundle(); b1.putInt(TrivialFragment.ARGUMENT_LAYOUT, R.layout.add_event_basic_tab); f1.setArguments(b1); - final Fragment f2 = new TrivialFragment(); + f2 = new TrivialFragment(); final Bundle b2=new Bundle(); b2.putInt(TrivialFragment.ARGUMENT_LAYOUT, R.layout.add_event_details_tab); f2.setArguments(b2); - final Fragment f3 = new TrivialFragment(); + f3 = new TrivialFragment(); final Bundle b3=new Bundle(); b3.putInt(TrivialFragment.ARGUMENT_LAYOUT, R.layout.add_event_other_tab); f3.setArguments(b3); diff --git a/src/ro/ieval/unical/AddEventTabListener.java b/src/ro/ieval/unical/AddEventTabListener.java index 364ce55..aa9c763 100644 --- a/src/ro/ieval/unical/AddEventTabListener.java +++ b/src/ro/ieval/unical/AddEventTabListener.java @@ -4,6 +4,8 @@ import android.app.ActionBar; import android.app.ActionBar.Tab; import android.app.Fragment; import android.app.FragmentTransaction; +import android.widget.EditText; +import android.widget.TextView; import java.text.ParseException; import java.text.SimpleDateFormat; @@ -23,6 +25,13 @@ public class AddEventTabListener implements ActionBar.TabListener { @Override public void onTabSelected(final Tab tab, final FragmentTransaction ft) { ft.replace(R.id.fragment_container, fragment); + switch (tabId) { + case 0: + if(fragment.getView()==null) System.err.println("MuieLaComisie"); + //EditText title =(EditText) fragment.getView().findViewById(R.id.eventtitle); + // title.setText(ev.title, TextView.BufferType.EDITABLE); + break; + } } @Override -- 2.39.2