Android databases technology - Java for Android App Development

I am app developer and i plan to do application, which uses online database (on server), and i would like to ask, what are the most common used technologies(i mean which SQL databases). Im in touch with MySQL but think it isnt the best solution available. So what is your favourite way to connect your app with database?
//Do you know any good literature with this topic?

JohnDeere1334 said:
I am app developer and i plan to do application, which uses online database (on server), and i would like to ask, what are the most common used technologies(i mean which SQL databases). Im in touch with MySQL but think it isnt the best solution available. So what is your favourite way to connect your app with database?
//Do you know any good literature with this topic?
Click to expand...
Click to collapse
I think you should use GoogleAppEngine it shall simpify things if you dont plan for BIG DATA
Sent from my GT-S5302 using Tapatalk 2

It depends of how much data you plan to store and how many users you plan to have

It depends on connections
JohnDeere1334 said:
I am app developer and i plan to do application, which uses online database (on server), and i would like to ask, what are the most common used technologies(i mean which SQL databases). Im in touch with MySQL but think it isnt the best solution available. So what is your favourite way to connect your app with database?
//Do you know any good literature with this topic?
Click to expand...
Click to collapse
Pool of connections are preferable when your app uses many connections . It's already realized in Java and you may easily use it.

http://forum.xda-developers.com/showthread.php?t=2325799
Sent from my GT-S5570 using XDA Premium 4 mobile app

arpitkh96 said:
http://forum.xda-developers.com/showthread.php?t=2325799
Sent from my GT-S5570 using XDA Premium 4 mobile app
Click to expand...
Click to collapse
That is an extremely limited guide that means a working internet connection has to be present for the app to work on all launches of the app.
A more efficient way of doing it is to put the JSON output into a local SQLite database, therefore effectively mirroring the online one and then make the app read (and write if needed) information from the local database - if you need changes to be written to the local database you would then need to add a post method that parses the local DB to JSON and sends it to the server for the server to update its version of the DB.
This way takes a little more coding but means that you can use the app offline.
Sent from my HTCSensation using Tapatalk

Jonny said:
That is an extremely limited guide that means a working internet connection has to be present for the app to work on all launches of the app.
A more efficient way of doing it is to put the JSON output into a local SQLite database, therefore effectively mirroring the online one and then make the app read (and write if needed) information from the local database - if you need changes to be written to the local database you would then need to add a post method that parses the local DB to JSON and sends it to the server for the server to update its version of the DB.
This way takes a little more coding but means that you can use the app offline.
Sent from my HTCSensation using Tapatalk
Click to expand...
Click to collapse
Depends on the op.wouldnt it be better if app simply downloads the database and use it(if he is only reading it).
Sent from my GT-S5570 using XDA Premium 4 mobile app

arpitkh96 said:
Depends on the op.wouldnt it be better if app simply downloads the database and use it(if he is only reading it).
Sent from my GT-S5570 using XDA Premium 4 mobile app
Click to expand...
Click to collapse
If he could be sure his users would have a constant network connection then maybe, however, my method allows for offline viewing and more control over when the app connects to the internet if its tied into a refresh button for example.
Sent from my HTCSensation using Tapatalk

Jonny said:
If he could be sure his users would have a constant network connection then maybe, however, my method allows for offline viewing and more control over when the app connects to the internet if its tied into a refresh button for example.
Sent from my HTCSensation using Tapatalk
Click to expand...
Click to collapse
Little offtopic
Like if i want to open pdf from a file i use this
Code:
public void openpdf(File f){
if(f.exists()) {
Uri path =Uri.fromFile(f);
Intent intent =new Intent(Intent.ACTION_VIEW);
intent.setDataAndType(path,"application/pdf");
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
try {startActivity(intent);}
catch (ActivityNotFoundException e) {
Toast.makeText(MainActivity.this,"No Application Available to View PDF",Toast.LENGTH_SHORT).show();
}}}
What should i use to open archive files(zip,rar) (from intent).i have tried general method of getting Mime type but that didnt worked
Sent from my GT-S5570 using XDA Premium 4 mobile app

arpitkh96 said:
Little offtopic
Like if i want to open pdf from a file i use this
Code:
public void openpdf(File f){
if(f.exists()) {
Uri path =Uri.fromFile(f);
Intent intent =new Intent(Intent.ACTION_VIEW);
intent.setDataAndType(path,"application/pdf");
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
try {startActivity(intent);}
catch (ActivityNotFoundException e) {
Toast.makeText(MainActivity.this,"No Application Available to View PDF",Toast.LENGTH_SHORT).show();
}}}
What should i use to open archive files(zip,rar) (from intent).i have tried general method of getting Mime type but that didnt worked
Sent from my GT-S5570 using XDA Premium 4 mobile app
Click to expand...
Click to collapse
if you wanted to open it from within the application you could do something like:
Code:
ZipFile z = new ZipFile("/mtn/sdcard/download/teste.zip");
But if you wanted the intent to launch into a different app to handle the zip (eg Archidroid etc) then have you tried something like:
Code:
File file = new File("mnt/sdcard/download/test.zip");
Intent i = new Intent();
i.setAction(android.content.Intent.ACTION_VIEW);
i.setDataAndType(Uri.fromFile(file), "application/zip");
try {
startActivity(i);
} catch (ActivityNotFoundException e) {
Toast.makeText(MainActivity.this,"No Application Available to View Zip files",Toast.LENGTH_SHORT).show();
}

Jonny said:
if you wanted to open it from within the application you could do something like:
Code:
ZipFile z = new ZipFile("/mtn/sdcard/download/teste.zip");
But if you wanted the intent to launch into a different app to handle the zip (eg Archidroid etc) then have you tried something like:
Code:
File file = new File("mnt/sdcard/download/test.zip");
Intent i = new Intent();
i.setAction(android.content.Intent.ACTION_VIEW);
i.setDataAndType(Uri.fromFile(file), "application/zip");
try {
startActivity(i);
} catch (ActivityNotFoundException e) {
Toast.makeText(MainActivity.this,"No Application Available to View Zip files",Toast.LENGTH_SHORT).show();
}
Click to expand...
Click to collapse
Thanks.
One more.l am asking about the method i suggested of downloading the database for readonly purpose.where should i upload the database so that server could handle multiple downloads etc.
Sent from my GT-S5570 using XDA Premium 4 mobile app

arpitkh96 said:
Thanks.
One more.l am asking about the method i suggested of downloading the database for readonly purpose.where should i upload the database so that server could handle multiple downloads etc.
Sent from my GT-S5570 using XDA Premium 4 mobile app
Click to expand...
Click to collapse
I'd have thought just having the database on the server and using the php script to output a JSON response then put the JSON response into a local SQLite database would do that.... I'm not entirely sure what you're asking though

Jonny said:
I'd have thought just having the database on the server and using the php script to output a JSON response then put the JSON response into a local SQLite database would do that.... I'm not entirely sure what you're asking though
Click to expand...
Click to collapse
Have you ever used Dictionary.com app.it has an option for offline mode in which it downloads the whole database into the internal memory to use it any time.i want to do that.I am asking where should i upload that database(server,website etc) so that i could download that easily in myapp
Sent from my GT-S5570 using XDA Premium 4 mobile app

arpitkh96 said:
Have you ever used Dictionary.com app.it has an option for offline mode in which it downloads the whole database into the internal memory to use it any time.i want to do that.I am asking where should i upload that database(server,website etc) so that i could download that easily in myapp
Sent from my GT-S5570 using XDA Premium 4 mobile app
Click to expand...
Click to collapse
Ah right I get it, you would need a server with sql support - or at least a hosting package that allows you to add your own database, then just use phpMyAdmin/MySQL to create the database.

Jonny said:
Ah right I get it, you would need a server with sql support - or at least a hosting package that allows you to add your own database, then just use phpMyAdmin/MySQL to create the database.
Click to expand...
Click to collapse
Thats ok.but which server or website can do this.
Sent from my GT-S5570 using XDA Premium 4 mobile app

arpitkh96 said:
Thats ok.but which server or website can do this.
Sent from my GT-S5570 using XDA Premium 4 mobile app
Click to expand...
Click to collapse
2 services I'm currently using are http://www.unlimitedwebhosting.co.uk/ & http://x10premium.com/ - you're probably ok with the low cost options that offer "unlimited" stuff (subject to interpretation and fair use etc) because the overhead on MySQL is not a lot so you probably won't use much bandwidth.
As a general guide pretty much anyone who offers cpanel or similar control software will have MySQL enabled - though be sure to check because hosts have been known to disable MySQL in cpanel before.

Related

lloydstsb banking problem

Hi all, first post so go easy on me not sure i'm in the right forum, had my dhd for about two weeks now and can't fault the phone, but tried to get internet banking on it and can't seem to get it to download, I followed all of the instructions on the lloydstsb website and I get as far as downloading a file (downloadclient.jad) but when I try to open it the phone asks me to complete action using either DB editor or file editor, if I then open it with either I just get a load of text? i'm stuck, any help would be great.
P.s the program is monitise
Thanks hOOter343.............
Just go through the site as you normally would.
Change your browser to non-mobile view in the settings.
Just make sure your on https and not on a public wifi network.
I didn't bother with the app, lose your phone and your buggered.
Thanks flacid monkey, will do that it seems safer.
hOOter343...
hooter343 said:
Thanks flacid monkey, will do that it seems safer.
hOOter343...
Click to expand...
Click to collapse
FYI, a .jad is an exacutable java application, if you want to run it on your device you will need a JRE like jbed
can someone plee post the lloyds apk or pm with it
Strange mine installed fine?
Sent from my Desire HD using XDA App
Please can someone upload the apk for lloyds tsb mobile banking as i am outside the UK.
Sent from my LG-P920 using XDA App
They have stopped the app. They are only providing mobile website now.

Intent to start samsung calculator in jellybean

Hi all,
I was working on an custom launcher app tha blocks certain functions and allow certain functions depending on the user who logged in. The app is working fine.but i have a problem now.i used to test app with emulators and my office phone running vanilla android.when i tested it on a samsung device due to the change in package name of default calculator in samsung phones, the app crashes. Could someone give me an code snippet to start the default calculator app in samsung devices running jb or ics??
Sent from my GT-S5360 using xda app-developers app
jaison thomas said:
Hi all,
I was working on an custom launcher app tha blocks certain functions and allow certain functions depending on the user who logged in. The app is working fine.but i have a problem now.i used to test app with emulators and my office phone running vanilla android.when i tested it on a samsung device due to the change in package name of default calculator in samsung phones, the app crashes. Could someone give me an code snippet to start the default calculator app in samsung devices running jb or ics??
Sent from my GT-S5360 using xda app-developers app
Click to expand...
Click to collapse
Why don't you get the application list programmatically and search it for something like "calc" or "calculator"?
jaison thomas said:
Hi all,
I was working on an custom launcher app tha blocks certain functions and allow certain functions depending on the user who logged in. The app is working fine.but i have a problem now.i used to test app with emulators and my office phone running vanilla android.when i tested it on a samsung device due to the change in package name of default calculator in samsung phones, the app crashes. Could someone give me an code snippet to start the default calculator app in samsung devices running jb or ics??
Sent from my GT-S5360 using xda app-developers app
Click to expand...
Click to collapse
Code:
Intent mIntent = getPackageManager().getLaunchIntentForPackage(
"[COLOR="Teal"]com.whatever.the.samsung.calc.package.is[/COLOR]");
startActivity(mIntent);
Replace the code in blue with the samsung calculator package name.
And if you want to launch it with a nice animation on jb :
Code:
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
Bundle b = null;
Bitmap bitmap = Bitmap.createBitmap(getWidth(),
getHeight(), Bitmap.Config.ARGB_8888);
b = ActivityOptions.makeThumbnailScaleUpAnimation(this, bitmap, 0, 0).toBundle();
startActivity(mIntent, b);
} else
startActivity(mIntent);
nikwen said:
Why don't you get the application list programmatically and search it for something like "calc" or "calculator"?
Click to expand...
Click to collapse
Actually thats a small project for a small group.i dont want it to be complicated for them
but its better to do as u said
Androguide.fr said:
Code:
Intent mIntent = getPackageManager().getLaunchIntentForPackage(
"[COLOR="Teal"]com.whatever.the.samsung.calc.package.is[/COLOR]");
startActivity(mIntent);
Replace the code in blue with the samsung calculator package name.
Click to expand...
Click to collapse
Actually what i want is the samsung calculator package name.
Thax for your help guys .
Sent from my GT-S5360 using xda app-developers app
Androguide.fr said:
Code:
Intent mIntent = getPackageManager().getLaunchIntentForPackage(
"[COLOR="Teal"]com.whatever.the.samsung.calc.package.is[/COLOR]");
startActivity(mIntent);
Replace the code in blue with the samsung calculator package name.
And if you want to launch it with a nice animation on jb :
Code:
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
Bundle b = null;
Bitmap bitmap = Bitmap.createBitmap(getWidth(),
getHeight(), Bitmap.Config.ARGB_8888);
b = ActivityOptions.makeThumbnailScaleUpAnimation(this, bitmap, 0, 0).toBundle();
startActivity(mIntent, b);
} else
startActivity(mIntent);
Click to expand...
Click to collapse
On Gingerbread it was com.android.calculator
jaison thomas said:
Actually thats a small project for a small group.i dont want it to be complicated for them
but its better to do as u said
Actually what i want is the samsung calculator package name.
Thax for your help guys .
Sent from my GT-S5360 using xda app-developers app
Click to expand...
Click to collapse
Just type this in terminal on your samsung device :
Code:
pm list packages -f > /sdcard/packages.txt
grep calc /sdcard/packages.txt
It will return all package names that contain "calc"

How to update app content whenever website is updated

Am working on a news reader app and the should synchronize with with the webserver such that whenever the desktop site is updated the also picks the update. What is the best approach to this? Thanks for the help.
If the webserver can output XML, JSON or even an RSS feed, you could grab it from the server , parse it and display it in your app.
Sent from my SGH-I337M using xda app-developers app
An RSS feed is probably the easiest and quickest way to implement.
The best practice would probably be to expose a JSON/RPC API which your app can call when it's started and depending, for example, on a version code parameter of the JSON object, will retrieve the rest of the information or not if the version code is the same as last time (ie: saved in SharedPreferences)
Cool. Thanks for the input. You just explained what I have in mind but I have no idea on what the code would look like. Any help with that? Thanks
blissville said:
Cool. Thanks for the input. You just explained what I have in mind but I have no idea on what the code would look like. Any help with that? Thanks
Click to expand...
Click to collapse
Are you also the developer of the website you want to synchronize with or do you want to collect news from any arbitrary site?
Am collecting news from an arbitrary site
Sent from my Nexus 7 using xda app-developers app
blissville said:
Am collecting news from an arbitrary site
Sent from my Nexus 7 using xda app-developers app
Click to expand...
Click to collapse
Then i think the best and most common way is catching your data via RSS.
But you should check if your targeted news site allows the usage of their content in third party apps.
You can retrieve the RSS files with simple http requests. It contains XML with the news your want to provide and additionally meta data like the publishing dates.
For example the XDA RSS file:
http://forum.xda-developers.com/external.php?type=RSS2
You can also parse information in your own server, gathering information there and providing info to the app. This way at least you don't consume brandwith of the sites you are gathering information from.

[Q] how do file managers retain listview

In most of the file managers present on Google play. when we open a folder and then go back,list view is automatically scrolled to the position from where folder was opened. So either the scroll position or whole list view is saved. I want to ask how this can be implemented?
Sent from my XT1033 using XDA Premium 4 mobile app
arpitkh96 said:
In most of the file managers present on Google play. when we open a folder and then go back,list view is automatically scrolled to the position from where folder was opened. So either the scroll position or whole list view is saved. I want to ask how this can be implemented?
Sent from my XT1033 using XDA Premium 4 mobile app
Click to expand...
Click to collapse
yes, there are a few ways to do it, probably the easiest is just storing the scroll position yourself, much info on SO about this if you google... also complex views like listView save their own bundles too iirc
deanwray said:
yes, there are a few ways to do it, probably the easiest is just storing the scroll position yourself, much info on SO about this if you google... also complex views like listView save their own bundles too iirc
Click to expand...
Click to collapse
Thanks I got it
Sent from my XT1033 using XDA Premium 4 mobile app

Can I use tabs in more than 1 activity?

I'm making an app that uses tabs in my main activity. I want to be able to open another activity which will also use tabs. Everything I've could think of to try results in my app crashing when I open the second activity.
Is this possible to do? If so can someone help me out?
Sent from my Moto X using XDA Free mobile app
jeb192004 said:
I'm making an app that uses tabs in my main activity. I want to be able to open another activity which will also use tabs. Everything I've could think of to try results in my app crashing when I open the second activity.
Is this possible to do? If so can someone help me out?
Sent from my Moto X using XDA Free mobile app
Click to expand...
Click to collapse
Log? Activity code? Layouts? Manifest file?
Usually the most common reason this happening is because people forget to add the new activity to the AndroidManifest.xml file, if you've already done that then we need more information than you've currently given.
Sent from my HTC One using Tapatalk
It is definitely possible, can you show us where it errors out (I.e. logcat)
Well. I just discovered viewpager and I was able to get that to work how I wanted to use the tabs. Kinda wish I would've found this before asking the question. I have the horizontal scrolling working to swipe between pages. Can you guys help me get the vertical scroll view to work so I can view the rest of the text on each page?
Edit: never mind. Just got the vertical scrolling to work.
Sent from my Moto X using XDA Free mobile app
Code:
<ScrollView >
<LinearLayout> <!--or whatever layout you choose-->
</LinearLayout>
</ScrollView>

Categories

Resources