Android Studio data xml file - android

I am looking at tutorials and for some reason I can not find the mysharedpremain.xml file. In my android studio I dont have a data tab.
Can somebody help? The image of the tutorial is below
Thank you

There is no such tab called data in android studio. data/data is the place where the android system stores your application and it's related fies,To see your application and related files you need to access the android file system.
In order to do that follow the below steps
Run your app in an emulator or in a rooted android device
open android device monitor as described in the image you posted
on the left side of the window you will see devices tab click on the emulator/device on which your app is currently running.
Click on file explorer tab and select data folder inside that you will find one more data folder select it and search for package name that matches your app package name and expand it..you will find your preference file if you already created one

Related

Android : View SQLite Database

I'm running Android Studio 1.3 and working on tutorial app. I'm using GenyMotion for testing purpose. I have written some code to create a database. Now I want to see whether that database has been created or not. If yes then where it is stored. In Eclipse we used to have DDMS Monitor but no such thing is present in Android Studio. So How to do so?
Easiest way is using Android Device Monitor to get the database file and SQLite DataBase Browser to view the file while still using Android Studio to program android.
1) Run and launch database app with Android emulator from Android Studio.
2) Run Android Device Monitor. How to run?; Go to [your_folder] > sdk >tools. You can see monitor.bat in that folder. shift + right click inside the folder and select "Open command window here". This action will launch command prompt. type monitor and Android Device Monitor will be launched.(There are other ways to open this too. Search it)
3) Select the emulator that you are currently running. Then Go to data>data>[your_app_package_name]>databases
4) Click on the icon (located at top right corner) (hover on the icon and you will see "pull a file from the device") and save anywhere you like
5) Launch SQLite DataBase Browser. Drag and drop the file that you just saved into that Browser. (You can view the database using any SQLite browser of your choice)
6) Go to Browse Data tab and select your table to view.

Accessing data from device in Android Studio

it's my first question here. I searched a lot on the site but didn't find any answer for my question.
Basically, I want to load a directory containing jpeg and mp3 in the tablet and retrieve the path from these files and put them in a SQLite database. I have no trouble using the database but I don't know how to retrieve the paths of the files or even to verify the existence of the directory. Any hint on how to access these files without putting them in the application drawable and sound folder would be appreciated. Thanks!
Goto the Android Device Monitor in the android studio and new poup window will open with the devices list in the left pane and in the right pan select the File Explorer Tab and that's it

Database not visible in DDMS folder when real device used instead of emulator

I am creating a sample application which will create a database, Inserts data and finally displays it in a spinner.
For testing I am using my android phone instead of Emulator (As I am fedup with its slow response).
My problem is application running succesfully but spinner is not displaying any result also I am unable to view any folder structure under DDMS->data.
I am confused whether database created or not, Please suggest me how to view the database if we use real device instead of emulatpor
You must start you emulator, browse the emulator files in the DDMS view then select File explorer then go to data > data > com.your.package > databases > your_database_name and a new tab will appear with your data! It won't work on a real device.
You can even pull/export the database and analyse it more effectively with SQLite Browser
enjoy !
You can't get SQLite databse file from an Android real device if it is not rooted. Because to access the data folder of your application you have to provide the permission for it.
But you can run your application in an android emulator and following is the way:
From DDMS, in Devices menu select your emulator.
You can see data folder in File Explorer.
Path is: data->data->Application Package Name->Databases->Database Name
U just goto File Explorer
Windows>show view>File explorer>data>package>database name to see your database
in emulator

How can I find my SQLite database file on my computer?

I implemented my first app using Xamarin Studio (Mono for Android). This app stores some data in a SQLite db, which works fine on a Sony Tablet S device.
My question is: is there a way to get db file and see, for example, its size?
I looked up to the following path
/data/data/My-Application-Package-Name/databases/My-database-name
but it doesn't seem to exist.
Thanks for any help!
You can use Eclipse to go right to it using the sqlite manager plug-in (http://www.coderzheaven.com/2011/04/18/sqlitemanager-plugin-for-eclipse/)
Download the *.jar file from the website I reference above to the
"dropins" folder in eclipse (open your eclipse folder and you should
see it)
Then restart eclipse and go to the DDMS. You may have to do
windows->views-ddms if it isn't already being displayed...
Select your device from the left panel then use the file explorer to go to your data
directory/YOURAPP/databases. Hopefully there will be an icon that
shows up when you select your database. If not, rename your database to use the "db" ext.
Click it and it should open in the manager tab.
This is a valid database location (//data/data/My-Application-Package-Name/databases/My-database-name), but you can access it from file managers if you have root access only.
Look how it can be done here. Otherwise, if you want to get some info trough the code, you're doing something wrong, so publish the code and logcat.

Where does application data file actually stored on android device?

I have developed an Android app using Appcelerator Titanium. This app will create a file in applicationDataDirectory and install a database as well.
If run on emulator, I can locate those files using "adb" command. But how about on Android device? Can I use the "My Files" app to view those file I created? (since I can see files created by other application there.)
Moreover, I expect once I removed the app on device, it will automatically remove the related files and database. Is that true?
Because I found that even I removed the app from the device, the database seems left behind. I can tell because after deleting app and re-run on device(from Titanium), it show previous data.
I am using Ti SDK 2.0.1GA2, Android Runtime V8. And using Samsung Galaxy Tab for testing.
Thanks in advance.
Application Private Data files are stored within <internal_storage>/data/data/<package>
Files being stored in the internal storage can be accessed with openFileOutput() and openFileInput()
When those files are created as MODE_PRIVATE it is not possible to see/access them within another application such as a FileManager.
On Android 4.4 KitKat, I found mine in:
/sdcard/Android/data/<app.package.name>
Use Context.getDatabasePath(databasename). The context can be obtained from your application.
If you get previous data back it can be either a) the data was stored in an unconventional location and therefore not deleted with uninstall or b) Titanium backed up the data with the app (it can do that).
You can get if from your document_cache folder, subfolder (mine is 1946507). Once there, rename the "content" by adding .pdf to the end of the file, save, and open with any pdf reader.
This is a simple way to identify the application related storage paths of a particular app.
Steps:
Have the android device connected to your mac or android emulator open
Open the terminal
adb shell
find .
The "find ." command will list all the files with their paths in the terminal.
./apex/com.android.media.swcodec
./apex/com.android.media.swcodec/etc
./apex/com.android.media.swcodec/etc/init.rc
./apex/com.android.media.swcodec/etc/seccomp_policy
./apex/com.android.media.swcodec/etc/seccomp_policy/mediaswcodec.policy
./apex/com.android.media.swcodec/etc/ld.config.txt
./apex/com.android.media.swcodec/etc/media_codecs.xml
./apex/com.android.media.swcodec/apex_manifest.json
./apex/com.android.media.swcodec/lib
./apex/com.android.media.swcodec/lib/android.hidl.memory.token#1.0.so
./apex/com.android.media.swcodec/lib/libcodec2_soft_common.so
./apex/com.android.media.swcodec/lib/android.hardware.graphics.mapper#2.0.so
./apex/com.android.media.swcodec/lib/libcodec2_soft_vorbisdec.so
./apex/com.android.media.swcodec/lib/libcodec2_soft_h263dec.so
./apex/com.android.media.swcodec/lib/libhidltransport.so
./apex/com.android.media.swcodec/lib/libcodec2_soft_h263enc.so
./apex/com.android.media.swcodec/lib/libcodec2_vndk.so
./apex/com.android.media.swcodec/lib/android.hardware.graphics.mapper#2.1.so
./apex/com.android.media.swcodec/lib/libmedia_codecserviceregistrant.so
./apex/com.android.media.swcodec/lib/libhidlbase.so
./apex/com.android.media.swcodec/lib/libcodec2_soft_aacdec.so
./apex/com.android.media.swcodec/lib/libcodec2_soft_vp9dec.so
.....
After this, just search for your app with the bundle identifier and you can use adb pull command to download the files to your local directory.

Categories

Resources