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"
Related
Just started teaching myself to program Android apps. I have a book called "Android Apps for Absolute Beginners" by Wallace Jackson. Im in the process of making a hello world app and the instructions for making an icon for my app is a bit convoluted.
I have 3 icons, 72x72, 48x48, and 32x32. I have put them in /res/drawable-hdpi/icon.png, /drawable-mdpi/icon.png, /drawable-ldpi/icon.png, respectively.
The app runs in the emulator, but when i goto the app drawer it shows a default icon instead of mine.
Any help would be great. As a side note, is 72x72/hdpi what would be used for qHD and 1280x800 tablet screens?
Still cant figure this out, if anyone could help itd be great. Thanks
Your Manifest file must point to the name of your icon in the drawable folder, instead of the default icon. So do that where it says android:icon="@drawable/icon"
Sent from my Nexus S using XDA Premium App
Not sure how you are having problems here.... If you have not edited the manifest file it will look for the icon.png in whichever drawable folder the phone is using. Eg.. HTC Desire will read from drawable-hdpi.
This is a good resource for creating icons btw...
http://android-ui-utils.googlecode.com/hg/asset-studio/dist/index.html
One thing to note is that the emulator (and sometimes real devices) are bad at refreshing icons. Try and uninstall your app before running it again from Eclipse.
Tony
Thx guys. My manifest and folders were good, but I was using a 1.5 AVD. As soon as I changed it to 2.3 it worked. I'll have to test later to find out how to get it to work on older versions of Android
Sent from my PG86100 using XDA App
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.
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
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>
I'm trying to make my own icon pack, and I don't know much about xml coding. I've been trying to learn through other people's templates, but I was hoping someone could help explain to me how to target specific launchers. What about the xml coding targets LGHome launcher? I was hoping to make my start there.
-I fully understand DPI, and the sizes of the icons required to work in all forms (mdpi, hdpi, xhdpi, xxhdpi, and xxxhdpi) I also understand that the Google Play icon must be at least 512px x 512px
-I understand file formatting, though I DO NOT KNOW what format would be best in this case to use (I think bitmaps were recommended strongly)
-I have the latest version of Android Studio and Android SDK Standalone
I will be experimenting with codes and icons, but I am unsure of how to test them on one of my own Android Devices (LG G2 & Nexus 10)
Would I upload the file directly to my device once I pack it? How do I make my project into an APK
To target other launchers you need to find package id of the particular launcher and add the same to main activity of your app.
You need to export the file using adt or to test ypu can also run the app in adt and install it in your phone.
Do some google you will understand or co relate what i said
Sent from my LG-D802 using XDA Free mobile app
Spoonfeed required, I'm totally new at this. Where can I find the package id of each individual launcher? I've been Googling how to do this, but it isn't exactly a popular topic, which is why I came here to ask for help.
I will look into everything you said though, thank you.
karmaxdw said:
Spoonfeed required, I'm totally new at this. Where can I find the package id of each individual launcher? I've been Googling how to do this, but it isn't exactly a popular topic, which is why I came here to ask for help.
I will look into everything you said though, thank you.
Click to expand...
Click to collapse
Install apex launcher and tap for 3 sec on the home screen free area. This will open menu and show u shortcut option slext the same and then select activity.
Now scroll down until u find the desired launcher and it will show u the package id.
Ps you need to have launcher installed first to see the package id.
Alternatively, open playstore in pc and search the app you want to see the package id. Open its page and on top it will show you the package id.
Sent from my LG-D802 using XDA Free mobile app
vishal11in said:
Install apex launcher and tap for 3 sec on the home screen free area. This will open menu and show u shortcut option slext the same and then select activity.
Now scroll down until u find the desired launcher and it will show u the package id.
Ps you need to have launcher installed first to see the package id.
Alternatively, open playstore in pc and search the app you want to see the package id. Open its page and on top it will show you the package id.
Sent from my LG-D802 using XDA Free mobile app
Click to expand...
Click to collapse
Thank you, that was very helpful. I'll reply here if I need any more assistance.
karmaxdw said:
Thank you, that was very helpful. I'll reply here if I need any more assistance.
Click to expand...
Click to collapse
No problem let me know
Btw did you try my new lg home theme.
Sent from my LG-D802 using XDA Free mobile app
I may have, which was yours?
Also, I opened the Play Store page for many of the launchers, yet I can't seem to find the ID
Sent from my LG-LS980 using XDA Free mobile app