<application
android:name="ro.ieval.unical.Application"
android:allowBackup="true"
- android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@android:style/Theme.DeviceDefault.Light" >
<activity android:name=".EventListActivity">
+++ /dev/null
-<LinearLayout
-xmlns:android="http://schemas.android.com/apk/res/android"
-android:orientation="vertical"
-android:layout_width="fill_parent"
-android:layout_height="fill_parent" android:layout_gravity="center">
- <LinearLayout
- android:orientation="vertical"
- android:id="@+id/fragment_container"
- android:layout_width="match_parent"
- android:layout_height="match_parent" >
-
-</LinearLayout>
-</LinearLayout>
\ No newline at end of file
@Override
protected void onCreate(final Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
- setContentView(R.layout.add_event);
setTitle(R.string.add_event_title);
final ActionBar actionBar = getActionBar();
actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
import java.util.Date;
public class AddEventTabListener implements ActionBar.TabListener {
- public Fragment fragment;
+ private Fragment fragment;
private Event ev;
- int tabId;
+ private boolean isAdded = false;
+ private int tabId;
public AddEventTabListener(final Fragment fragment,Event e,int tabId) {
this.fragment = fragment;
@Override
public void onTabSelected(final Tab tab, final FragmentTransaction ft) {
- ft.replace(R.id.fragment_container, fragment);
+ if(isAdded)
+ ft.attach(fragment);
+ else {
+ isAdded = true;
+ ft.add(android.R.id.content, 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);
+ //title.setText(ev.title, TextView.BufferType.EDITABLE);
break;
}
}
ev.dtstart=s.getTime();
ev.dtend=s.getTime();
} catch (ParseException e) {
- e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
+ e.printStackTrace();
}
break;
case 2:
break;
}
- ft.remove(fragment);
+ ft.detach(fragment);
}
@Override
public void onTabReselected(final Tab tab, final FragmentTransaction ft) {
- // TODO Auto-generated method stub
-
+ // do nothing
}
}