Code example for SharedPreferences

Methods: getInt

1
		GdxTests.tests.add(MatrixTest.class); 
		List<String> testNames = GdxTests.getNames();
		setListAdapter(new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, testNames));
 
		prefs = getSharedPreferences("libgdx-tests", Context.MODE_PRIVATE);
		getListView().setSelectionFromTop(prefs.getInt("index", 0), prefs.getInt("top", 0));
	} 
 
	protected void onListItemClick (ListView listView, View view, int position, long id) {
		super.onListItemClick(listView, view, position, id);
 
		Editor editor = prefs.edit();
		editor.putInt("index", listView.getFirstVisiblePosition());
		editor.putInt("top", listView.getChildAt(0) == null ? 0 : listView.getChildAt(0).getTop());
		editor.commit();
 
		Object o = this.getListAdapter().getItem(position);
		String testName = o.toString();
 
		Bundle bundle = new Bundle();
Connect your IDE to all the code out there  Get Codota for Java