sanathp / databasemanager_for_android Goto Github PK
View Code? Open in Web Editor NEWDatabase Manager for your Android SQLlite database
License: Other
Database Manager for your Android SQLlite database
License: Other
This was very helpful for me to see what was happening inside my database. However, the application crashes when I click on my database from inside your activity after I store a blob (in my case a byte array from bitmap) in the database.
crud_dropdown.setAdapter(crudadapter);
lcrud.setId(299);
Hey, thanks for writing this. It's simple and crude but just fine for my project.
I would, however, suggest you not hardcode colors, especially Color.WHITE, as that makes your text invisible within applications that use the Holo.Light theme.
In my copy of AndroidDatabaseManager.java, I've deleted all the hardcoded colors (except for a few
REDs). That has made things better, but one oddity remains, and that is that the text for the values of database rows (what I see when I "click on the row below to update values or delete the tuple") is still invisible. I don't know why that is, but a hack that works is to grab the color of some text that is good, and force the (otherwise) invisible text to take on that color.
While inserting a button, I get the issue that "Cannot resolve method getActivity()". Can someone tell me how to resolve this?
Is this the way we are supposed to set our custom Constructor.
MyDatabaseHelper(Context context,AndroidDatabaseManager adm){
super(context, DATABASE_NAME, null , DATABASE_VERSION);
this.adm = adm;
}
public MyDatabaseHelper(Context context, String name, SQLiteDatabase.CursorFactory factory, int version) {
super(context, DATABASE_NAME, null , DATABASE_VERSION);
}
It would be nice if you could auto-dismiss the soft keyboard when the user clicks "Submit Query" or if they tap anywhere that is not a textView.
This code can be used:
public void setUpHideKeyboardListeners(View view) {
//Set up touch listener for non-text box views to hide keyboard.
if(!(view instanceof EditText)) {
view.setOnTouchListener(new View.OnTouchListener() {
public boolean onTouch(View v, MotionEvent event) {
hideSoftKeyboard(VoiceFragment.this.getActivity());
return false;
}
});
}
//If a layout container, iterate over children and seed recursion.
if (view instanceof ViewGroup) {
for (int i = 0; i < ((ViewGroup) view).getChildCount(); i++) {
View innerView = ((ViewGroup) view).getChildAt(i);
setUpHideKeyboardListeners(innerView);
}
}
}
Called as
setUpHideKeyboardListeners(view);
in OnCreateView();
To programmatically hide the keyboard:
public static void hideSoftKeyboard(Activity activity) {
View currentFocusView = activity.getCurrentFocus();
if (currentFocusView != null) {
InputMethodManager inputMethodManager = (InputMethodManager) activity.getSystemService(Activity.INPUT_METHOD_SERVICE);
inputMethodManager.hideSoftInputFromWindow(currentFocusView.getWindowToken(), 0);
}
}
and call it as something like:
hideSoftKeyboard(this);
or
hideSoftKeyboard(this.getActivity());
Thanks a lot for this contribution!!
This is a great project.
What licence does it use? I hope something like Apache 2.
Could you add licence files/headers?
by the time I clicked on the button to start the database manager. this "unfortunately, interface plugin has stopped" appear. I followed every step that you gave but still database manager is not starting. Please help me.
In the ReadMe file, the Android Manifest code is missing.
<activity android:name="PACKAGE.AndroidDatabaseManager"
android:label="@string/app_name"/>
In this case you don't need to change anything in SQLiteOpenHelper class at all. I only did this change in getData function:
SQLiteDatabase sqlDB = dbm.getWritableDatabase();
and worked perfectly.
Maybe I am missing something?
Cool program by the way, very useful, thanks.
The library show a message successful but does not update row or delete table.
why?
What about getdata ?
dbm.getData(Query8);
"Query" is misspelled a twice in various text boxes and messages (look for "Queru"). "Table" is also misspelled as "tuple".
Otherwise this code has been a tremendous help to me while debugging and testing THANK YOU so much! Seriously, this is great!
When I click on a row, I am shown a popup with "values", and "Click Here to Change this row" followed by the names and values of all the columns.
Now if I click on the spinner and choose "Update this row", everything works fine. However, if I directly click on a column value (without clicking on "Update this row"), it allows me to edit the value, but when I click OK, nothing happens. This is very confusing.
Suggestion: If I directly click on a column value (without clicking on "Update this row"), it should work exactly as if I have already clicked "Update this row".
Alternative suggestion: Don't allow editing of values unless "Update this row" has been clicked.
Not closing the cursors opened by queries.
Leaking resources.
On line 835 of AndroidDatabaseManager.java there is some id: 299 - what is it?
It works well when no database upgrades. But I got the following errors after upgrading the database(by dbHelper = new MyDatabaseHelper(this, "BookStore.db", null, 2)
):
11-14 09:57:08.108 23201-23201/com.xlab.iscas.databasetest E/AndroidRuntime: FATAL EXCEPTION: main java.lang.RuntimeException: Unable to start activity ComponentInfo{com.xlab.iscas.databasetest/com.xlab.iscas.databasetest.AndroidDatabaseManager}: android.database.sqlite.SQLiteException: Can't downgrade database from version 2 to 1 at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2097) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2122) at android.app.ActivityThread.access$600(ActivityThread.java:140) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1228) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:137) at android.app.ActivityThread.main(ActivityThread.java:4895) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:511) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:994) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:761) at dalvik.system.NativeStart.main(Native Method) Caused by: android.database.sqlite.SQLiteException: Can't downgrade database from version 2 to 1 at android.database.sqlite.SQLiteOpenHelper.onDowngrade(SQLiteOpenHelper.java:361) at android.database.sqlite.SQLiteOpenHelper.getDatabaseLocked(SQLiteOpenHelper.java:255) at android.database.sqlite.SQLiteOpenHelper.getWritableDatabase(SQLiteOpenHelper.java:164) at com.xlab.iscas.databasetest.MyDatabaseHelper.getData(MyDatabaseHelper.java:67) at com.xlab.iscas.databasetest.AndroidDatabaseManager.onCreate(AndroidDatabaseManager.java:246) at android.app.Activity.performCreate(Activity.java:5163) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1094) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2061) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2122) at android.app.ActivityThread.access$600(ActivityThread.java:140) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1228) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:137) at android.app.ActivityThread.main(ActivityThread.java:4895) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:511) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:994) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:761) at dalvik.system.NativeStart.main(Native Method)
Does anybody help? :)
Hi, I love this! Thank you!
One problem, if a table is empty, you cannot add a row or drop it. To fix this, look for if(c2!=null) (line 393).
Move line 401 - 670 above the if statement on 393.
It worked for me.
Thanks again!
Hi, there's a problem on click next page when recordcount is equal to maxrecords per page in paginatetable function.
I changed it to:
final Cursor c3 = indexInfo.maincursor;
indexInfo.numberofpages=(int) Math.ceil(((double)c3.getCount()/10)); //10 is max. records
And works. Regards.
Hi,
I was wondering if you can add a new feature that allows the Android Database manager class can use a individual SQLiteOpenHelper for each table.
Thanks
Prasanna
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.