//List Activity
import android.app.ListActivity;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;
import android.os.Bundle;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.ListView;
public class WorldMenu extends ListActivity{
String worldString2;
String worldString;
static String worldString3;
String[] worldMenu;
SharedPreferences worldList;
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setListAdapter(new ArrayAdapter<String>(WorldMenu.this, android.R.layout.simple_list_item_1, worldMenu));
worldMenu = worldString3.split(",");
worldMenu[worldMenu.length] = "Create World";
worldString = "Create World,";
worldList = getSharedPreferences("worldString",0);
worldString3 = worldList.getString("worldString", "Worlds not found.");
}
@Override
protected void onPause() {
// TODO Auto-generated method stub
super.onPause();
worldString2 = worldString3;
Editor editor = worldList.edit();
editor.putString("worldStuff",worldString2);
editor.commit();
}
@Override
protected void onListItemClick(ListView l, View v, int position, long id) {
// TODO Auto-generated method stub
super.onListItemClick(l, v, position, id);
if(position == 0){
Intent openGenerator = new Intent("blablabla.WORLDNAME");
startActivity(openGenerator);
}
}
}