Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Storing in Intent in an SQLite database with android

I have an android appand I want to store an android Intent in the database as a blob field. I know the basics of storing and retrieving data of TEXT, INTEGER, etc, standards types in SQLite as my app already does all of that. I am not familiar with storing and retrieving blobs. I am presuming the blob is the best way, versus storing as a string and parsing back to and Intent. Maybe that is not a correct assumption though. The intents can be a package name, URI, may have extras, etc. That is why I would like to store/retrieve the whole intent and not just store parts.

like image 776
jroal Avatar asked Dec 21 '25 23:12

jroal


1 Answers

You can simply store the intent in a String way:

String intentDescription = intent.toUri(0);
//Save the intent string into your database

Later you can restore the Intent:

String intentDescription = cursor.getString(intentIndex);    
Intent intent = Intent.parseUri(intentDescription, 0);
like image 190
Chris.Zou Avatar answered Dec 24 '25 12:12

Chris.Zou



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!