If you think the Android project spades listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
Java Source Code
/**
* Copyright (C) 2013 Pau Picas Sans <pau.picas@gmail.com>
*/*www.java2s.com*/
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/package cat.picas.spadessamples;
import android.app.ListActivity;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.os.Bundle;
import cat.picas.spades.query.Query;
import cat.picas.spadessamples.adapter.CouplesCursorAdapter;
import cat.picas.spadessamples.model.DatabaseHelper;
import cat.picas.spadessamples.model.PersonDao;
publicclass AliasTableActivity extends ListActivity {
private DatabaseHelper mHelper;
private Cursor mCursor;
@Override
protectedvoid onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mHelper = new DatabaseHelper(this);
SQLiteDatabase db = mHelper.getReadableDatabase();
Query query = new Query(PersonDao.TABLE)
.leftJoin(PersonDao.TABLE.alias(), "%s = %s", PersonDao.ID.alias(), PersonDao.SPOUSE_ID)
.select(PersonDao.NAME, PersonDao.NAME.alias());
mCursor = query.execute(db);
setListAdapter(new CouplesCursorAdapter(this, mCursor, query.getCursorInfo()));
}
@Override
protectedvoid onDestroy() {
super.onDestroy();
mCursor.close();
mHelper.close();
}
}