Back to project page AquaBase.
The source code is released under:
GNU General Public License
If you think the Android project AquaBase listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
/* * This file is part of AquaBase./*ww w . j a v a2 s . c om*/ * * AquaBase is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * AquaBase is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with AquaBase. If not, see <http://www.gnu.org/licenses/>. * * Copyright (c) 2014 Cdric Bosdonnat <cedric@bosdonnat.fr> */ package org.aquabase; import java.util.Vector; import org.aquabase.data.AquabaseContentProvider; import org.aquabase.data.DatabaseHelper; import android.database.Cursor; import android.net.Uri; import android.os.Bundle; import android.support.v4.app.FragmentManager; import android.support.v7.app.ActionBarActivity; import android.util.Pair; public class DetailsActivity extends ActionBarActivity { public static final String URI = "uri"; //$NON-NLS-1$ @Override protected void onCreate(Bundle bundle) { super.onCreate(bundle); setContentView(R.layout.activity_details); Bundle extras = getIntent().getExtras(); // check from the saved Instance Uri uri = (bundle == null) ? null : (Uri) bundle.getParcelable(URI); // Or passed from the other activity if (extras != null) { uri = extras.getParcelable(URI); } Cursor cursor = getContentResolver().query(uri, null, null, null, null); if (cursor != null) { cursor.moveToFirst(); Vector<Pair<String, Integer>> names = AquabaseContentProvider.getColumnsNames(uri); DetailsFragment fragment = DetailsFragment.createInstance(cursor, names); // TODO Set the title and the fragment int sciNameId = cursor.getColumnIndexOrThrow(DatabaseHelper.COLUMN_SCI_NAME); String sciName = cursor.getString(sciNameId); setTitle(sciName); FragmentManager fragmentManager = getSupportFragmentManager(); fragmentManager .beginTransaction() .replace(R.id.details_frag, fragment).commit(); cursor.close(); } } }