I tried to look answers but I couldn't find any.
So I want to change my ListView items order in app and I don't have any idea how to do that. I guess Drag and Drop is too hard to build but how about some arrow buttons where you can press up and item move one row up? And how to make app to remember order that next time I open it every item are in order where I moved them?
I have my ListView Items in their own file (values->arrays.xml). And here is my ListView activity:
public class MainScreen extends ListActivity implements OnClickListener{
/** Called when the activity is first created. **/
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
final String[] links = getResources().getStringArray(R.array.links);
setListAdapter(ArrayAdapter.createFromResource(getApplicationContext(),
R.array.items, R.layout.rowlayout));
getListView().setOnItemClickListener(new OnItemClickListener() {
public void onItemClick(AdapterView<?> parent, View view,
int position, long id) {
String content = links[position];
Intent showContent = new Intent(getApplicationContext(),
Web.class);
showContent.setData(Uri.parse(content));
startActivity(showContent);
}
});
}
}
Anyone have idea how to make it work? :)