0
私は、プロジェクト全体をActivityGroupsからFragmentsを使用して変換しようとしています。ここで アクティビティグループをフラグメントに変換する
は私の古いコードです:SettingsActivityGroup
public class SettingsActivityGroup extends ActivityGroup
{
// Keep this in a static variable to make it accessible for all the nested activities, lets them manipulate the view
public static SettingsActivityGroup group;
// Need to keep track of the history if you want the back-button to work properly, don't use this if your activities requires a lot of memory.
private ArrayList<View> history;
// Window focus changed listener
public OnActivityGroupViewChanged activityGroupViewChangedListener = null;
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
// Allocate history
this.history = new ArrayList<View>();
// Set group
group = this;
// Start root (first) activity
Intent myIntent = new Intent(this, SettingsActivity.class); // Change to the first activity of your ActivityGroup
myIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
ReplaceView("SettingsActivity", myIntent);
}
SettingsActivity
public class SettingsActivity extends Activity
{
String[] settingsLabels = {"Viderestilling", "Voicemail", "Vis nummer",
"Kø styring", "Optag samtaler", "Services" };
ListView lv;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.settings);
lv = (ListView) findViewById(R.id.SettingsLV);
lv.setTextFilterEnabled(true);
populateListView();
}
private void populateListView()
{
lv.setAdapter(new ArrayAdapter<String>(this, R.layout.settings_items, R.id.settings_item_label, settingsLabels));
lv.setOnItemClickListener(new OnItemClickListener() {
public void onItemClick(AdapterView<?> parent, View view,
int position, long id)
{
// SwitchActivity(position);
}
});
}
私が代わりに活性のListFragmentを拡張したい場合は - 私は変更するには何が必要ですすべてがまだ動作していることを確認するには?