Displaying different layout in eclipse when using ViewFlipper

by Stephen Lebed » Tue, 20 Apr 2010 22:51:55 GMT


Sponsored Links
 Hi all,

I have a layout I'm creating that uses ViewFlipper for different
screens.  In eclipse's layout editor it only displays the first page
in the View.  Is there a keyboard shortcut, or function to flip to the
next screen?  Currently I'm building each screen in a seperate XML
file and then copying and pasting it into the main XML file.

Is there a better way to work here?

Thanks,
Stephen Lebed
Developer

--



Displaying different layout in eclipse when using ViewFlipper

by Kumar Bibek » Thu, 22 Apr 2010 17:54:15 GMT


 No you can't . You will have to run it to see it .

Thanks and Regards,
Kumar Bibek



>


Sponsored Links


Other Threads

1. Application crashes when I try to retrieve colums from a dbRow

The LaunchFav crashes at the first i.putExtra.  The error is "The
application Track My Drinks (process.parisj13.trackmydrinks) has stopped
unexpectedly.  What am I doing wrong?

        private Intent LaunchFav()
        {
                Cursor c = mFavDrink.fetchAllDrinks();
                Intent i = new Intent(this, FavoriteDrink.class);
                if(c.isBeforeFirst() && c.isAfterLast()){
                        i.putExtra(TrackMyDrinksDbAdapter.KEY_DRINK_ID,         
                        -1);
                        return i;
                }
                i.putExtra(TrackMyDrinksDbAdapter.KEY_DRINK_NAME, c.getString(
                                                                                
        c.getColumnIndex(TrackMyDrinksDbAdapter.KEY_DRINK_NAME)));
                i.putExtra(TrackMyDrinksDbAdapter.KEY_{*filter*}_VOL, c.getDouble(

c.getColumnIndex(TrackMyDrinksDbAdapter.KEY_{*filter*}_VOL)));
                i.putExtra(TrackMyDrinksDbAdapter.KEY_{*filter*}_PERC,c.getDouble(

c.getColumnIndex(TrackMyDrinksDbAdapter.KEY_{*filter*}_PERC)));
                i.putExtra(TrackMyDrinksDbAdapter.KEY_DRINK_ID, c.getInt(
                                                                                
        c.getColumnIndex(TrackMyDrinksDbAdapter.KEY_DRINK_ID)));
                return i;
        }




This code is the code that puts a record or updates a record when
necessary.



        private void ProcessFavorite(Intent i)
        {
                Bundle extras = i.getExtras();
                TextView tv = (TextView)this.findViewById(R.id.Otheramt);
                String FavName =
extras.getString(TrackMyDrinksDbAdapter.KEY_DRINK_NAME);
                double AlcVol =
extras.getDouble(TrackMyDrinksDbAdapter.KEY_{*filter*}_VOL, 0.00);
                double AlcPerc =
extras.getDouble(TrackMyDrinksDbAdapter.KEY_{*filter*}_PERC, 0.00);
                long RowId = 
extras.getLong(TrackMyDrinksDbAdapter.KEY_DRINK_ID);
                double curAlc = AlcVol * AlcPerc;
                othercnt++;
                
                mCurrentTime = new Date();
                
                if(mBAC == 0){
                        mStartTime = (Date) mCurrentTime.clone();
                }
                
                if(RowId == -1)
                {
                        mFavDrink.createDrink(FavName, AlcVol, AlcPerc);
                }
                else
                {
                        mFavDrink.updateDrink(RowId, FavName, AlcVol, AlcPerc);
                }
                
                mTot{*filter*} = mTot{*filter*} + curAlc;
                tv.setText(String.valueOf(othercnt));
                
                CalcDisplayBac();
        }







This is my entire DB Helper class.







package com.parisj13.trackmydrinks;


import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.SQLException;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.util.Log;

class TrackMyDrinksDbAdapter {
        public static final String KEY_DRINK_NAME ="drinkname";
        public static final String KEY_{*filter*}_VOL ="volume";
        public static final String KEY_{*filter*}_PERC = "perc";
        public static final String KEY_DRINK_ID = "_id";
        
        private static final String TAG = "TrackMyDrinksDbAdapter";
        private DatabaseHelper mDbHelper;
    private SQLiteDatabase mDb;
        
    private static final String DATABASE_CREATE =
        "create table drink (_id integer primary key autoincrement, "
                + "drinkname text not null, volume double not null, perc
double not null);";

    private static final String DATABASE_NAME = "trackmydrinks";
    private static final String DATABASE_TABLE = "drink";
    private static final int DATABASE_VERSION = 2;
    
    private final Context mCtx;

    private static class DatabaseHelper extends SQLiteOpenHelper {

                public DatabaseHelper(Context context) {
                        super(context, DATABASE_NAME, null, DATABASE_VERSION);
                }

                @Override
                public void onCreate(SQLiteDatabase db) {
                        db.execSQL(DATABASE_CREATE);
                        
                }

                @Override
                public void onUpgrade(SQLiteDatabase db, int oldVersion, int
newVersion) {
            Log.w(TAG, "Upgrading database from version " + oldVersion +
" to "
                    + newVersion + ", which will destroy all old data");
            db.execSQL("DROP TABLE IF EXISTS drink");
            onCreate(db);                       
                }

    }
    
    /**
     * Constructor - takes the context to allow the database to be
     * opened/created
     * 
     * @param ctx the Context within which to work
     */
    
    public TrackMyDrinksDbAdapter(Context ctx){
        this.mCtx = ctx;
    }
    
    /**
     * Open the notes database. If it cannot be opened, try to create a
new
     * instance of the database. If it cannot be created, throw an
exception to
     * signal the failure
     * 
     * @return this (self reference, allowing this to be chained in an
     *         initialization call)
     * @throws SQLException if the database could be neither opened or
created
     */
    public TrackMyDrinksDbAdapter open() throws SQLException {
        mDbHelper = new DatabaseHelper(mCtx);
        mDb = mDbHelper.getWritableDatabase();
        return this;            
    }
    
    public void close() {
        mDbHelper.close();
    }
    
    /**
     * Create a new drink using the name, {*filter*} volume and {*filter*}
percent 
     * provided. If the drink is successfully created return the new
rowId for 
     * that drink, otherwise return a -1 to indicate failure.
     * 
     */
    
    public long createDrink(String drinkName, double alcvol, double
alcperc){
        ContentValues initialValues = new ContentValues();
        initialValues.put(KEY_DRINK_NAME, drinkName);
        initialValues.put(KEY_{*filter*}_VOL, alcvol);
        initialValues.put(KEY_{*filter*}_PERC, alcperc);

        return mDb.insert(DATABASE_TABLE, null, initialValues);
    }
    
    /**
     * Return a Cursor over the list of all drinks in the database
     * 
     * @return Cursor over all notes
     */
    public Cursor fetchAllDrinks() {
        return mDb.query(DATABASE_TABLE, new String[] {KEY_DRINK_ID,
KEY_DRINK_NAME,
                        KEY_{*filter*}_VOL, KEY_{*filter*}_PERC}, null, null, null, 
null,
null);
        }
    
    /**
     * Return a Cursor positioned at the note that matches the given
rowId
     * 
     * @param rowId id of note to retrieve
     * @return Cursor positioned to matching drink, if found
     * @throws SQLException if note could not be found/retrieved
     */
    public Cursor fetchDrink(long rowId) throws SQLException {
        Cursor mCursor =
                mDb.query(true, DATABASE_TABLE, new String[] {KEY_DRINK_ID,
                    KEY_DRINK_NAME, KEY_{*filter*}_VOL, KEY_{*filter*}_PERC},
KEY_DRINK_ID + "=" + rowId, null,
                    null, null, null, null);
        if (mCursor != null) {
            mCursor.moveToFirst();
        }
        return mCursor;
    }
    
    /**
     * Update the note using the details provided. The note to be
updated is
     * specified using the rowId, and it is altered to use the title and
body
     * values passed in
     * 
     * @param rowId id of drink to update
     * @param name value to set drink name to
     * @param alcvol value to set {*filter*} volume to
     * @param alcperc value to set {*filter*} percent to
     * @return true if the note was successfully updated, false
otherwise
     */
    public boolean updateDrink(long rowId, String name, double alcvol,
double alcperc) {
        ContentValues args = new ContentValues();
        args.put(KEY_DRINK_NAME, name);
        args.put(KEY_{*filter*}_VOL, alcvol);
        args.put(KEY_{*filter*}_PERC, alcperc);
        
        return mDb.update(DATABASE_TABLE, args, KEY_DRINK_ID + "=" +
rowId, null) > 0;
    }
}


--~--~---------~--~----~------------~-------~--~----~

2. Intel announces new Pentium III brand for next generation processors.

M2 PRESSWIRE-12 January 1999-INTEL: Intel announces new Pentium III
brand for next generation processors (C)1994-99 M2 COMMUNICATIONS LTD
RDATE:110199 SANTA CLARA, Calif. -- Intel Corporation today announced
the Intel Pentium III processor brand name for its next generation
microprocessor code-named Katmai.


for more info http://www.intel-intel99.blogspot.com/
--~--~---------~--~----~------------~-------~--~----~

3. Popup Blocker software

4. Scrollview and GestureDetector

5. ExpandableListView with ResourceCursorAdapter problem

6. Question about long pressed

7. Intel Drops an 鈥楢tom` Brand