Share to EffectHub.com

You can earn money or coins from your share:)

Tips: you can use Sparticle for uploading away3D effects.

Tips: you can download Sparticle for uploading effects.

Tips: The ActionScript editor is supporting Away3D, Starling, Dragonbones and Flex frameworks.

Tips: paste the web page URL then click button:)

EffectHub.com: Your Best Source for Gaming
Login    or

Android:Sqlite database operation Demo

import java.util.List;import android.content.ContentValues;import android.content.Context;import android.database.Cursor;import android.database.sqlite.SQLiteDatabase;import android.database.sqlite.SQLiteDatabase.CursorFactory;import android.database.sqlite.SQLiteOpenHelper;import android.util.Log;public class ActivityCacheHelper extends SQLiteOpenHelper implements ActivityCacheInterface {	public static final String DB_NAME="Activity_Info";	public static final String TABLE_NAME_STRING="ActivityInfo";	public static final String OBJECT_STRING="ObjectString";	public static final String OBJECT_ID="ObjectId";	public static final String OBJECR_RANK="ObjectRank";			public ActivityCacheHelper(Context context, String name,			CursorFactory factory, int version) {		super(context, name, factory, version);	}	@Override	public void onCreate(SQLiteDatabase db) {				db.execSQL("create table if not exists "				+TABLE_NAME_STRING+"(" +OBJECT_ID+" INTEGER UNIQUE,"				+OBJECT_STRING+" TEXT," 				+OBJECR_RANK+" INTEGER PRIMARY KEY AUTOINCREMENT)"				);	}	@Override	public void onUpgrade(SQLiteDatabase arg0, int arg1, int arg2) {	}	@Override	public List getActivityInCache() {				List dataFeedItems=new ArrayList();				SQLiteDatabase db =getWritableDatabase();		//Log.d("ActivityCacheHelper", str);				Cursor cursor=db.query				(TABLE_NAME_STRING, 						null, 						null,						null,						null, 						null, 						OBJECR_RANK,						"50");		//Cursor cursor=db.rawQuery(str, null);						while (cursor!=null&&cursor.moveToNext())		{			String objectString=cursor.getString(1);			//Log.d("ActivityCacheHelper","ObjectString:"+objectString);			try {				LiveFeedItem liveFeedItem=Utils.createFromJson(objectString, LiveFeedItem.class);				dataFeedItems.add(liveFeedItem);			} catch (Exception e) {				e.printStackTrace();			}		}				Log.d("ActivityCacheHelper", "LocalActivitySize:"+dataFeedItems.size());				cursor.close();		db.close();		return dataFeedItems;	}	@Override	public void saveActivityitem(LiveFeedItem liveFeedItem) {				 SQLiteDatabase db =getWritableDatabase();		 		 ContentValues values=new ContentValues();		 String objectString=Utils.toJsonString(liveFeedItem);		 values.put(OBJECT_ID,objectString.hashCode());		 values.put(OBJECT_STRING, objectString);		 		 db.insertWithOnConflict(TABLE_NAME_STRING, null, values, SQLiteDatabase.CONFLICT_REPLACE);		 		 db.close();		 	}	@Override	public void ShowAllDataInDatabase() {		SQLiteDatabase db =getWritableDatabase();		String str="Select * from "+TABLE_NAME_STRING;		Cursor cursor=db.rawQuery(str, null);		Log.d("DatabaseInActivity","=============");				while (cursor!=null&&cursor.moveToNext())		{			Log.d("DatabaseInActivity", cursor.getInt(0)+"|"+cursor.getString(1).substring(0, 10)+"|"+cursor.getInt(2));					}		Log.d("DatabaseInActivity","=============");		cursor.close();		db.close();	}}


...

You must Sign up as a member of Effecthub to view the content.

1885 views    0 comments

You must Sign up as a member of Effecthub to join the conversation.

Join Effecthub.com


Or Login with Your Email Address:

Or Sign Up with Your Email Address:
This field must contain a valid email
Password should be at least 1 character

A PHP Error was encountered

Severity: Notice

Message: Undefined index: HTTP_ACCEPT_LANGUAGE

Filename: views/footer.php

Line Number: 6

A PHP Error was encountered

Severity: Notice

Message: Undefined index: HTTP_ACCEPT_LANGUAGE

Filename: controllers/topic.php

Line Number: 21

A PHP Error was encountered

Severity: Notice

Message: Undefined index: HTTP_ACCEPT_LANGUAGE

Filename: controllers/topic.php

Line Number: 85