Android multiple shortcuts - java

This link: http://www.kind-kristiansen.no/2010/android-adding-desktop-shortcut-support-to-your-app/ teaches me how to create a shortcut to any of my app's activities. However, when you look at your phone's shortcuts list, you see that apps like settings have a whole bunch of shortcuts. So there's my question: How do you add multiple shortcuts to the shortcut list?

You can have as many shortcuts for an App, as many public intents are declared in its manifest. The Activity in example is returning only one Intent and finishing on the spot. You can have your Shortcut Activity show a list of all available intents of your app and return that intent in its result.

Related

Is main activity mainly used as a bridge to separate classes and activities?

Lets say you've made a messaging app. The main activity would present different contacts and give you options for sharing, messaging, voice-calling, etc. Would each of those options have separate classes all stemming from the main activity class file? If so, would linking those classes into main activity be as easy as creating a method stub in the main activity to open those activities/classes for each option pressed?
I don't think that it's a good idea to use only one Activity for your Application.
Because in android an activity is a single, focused thing that the user can do. Almost all activities interact with the user.
I suppose that for options you want to have a different UI and different user interaction.
So i think that you should use multiple activity's for you options.
To find more information about Activity's check the link:
http://developer.android.com/reference/android/app/Activity.html

How can I know the intents needed to open system activities

I have the need to open android's default screen settings, and previously I wanted to open android's default alarm configuration activity, in the future I'm thinking I would want to open GPS settings.
How can I get the information needed to start this activities?
Where can I found the documentation about this?
What's the process for getting this information without googling for the specific activity?
Check the Common Intents listing in the documentation.
It's a pretty comprehensive listing of the actions, URI formats and MIME types for building Intents for the standard Android applications.
There is a list of Actions in the documentation listed here.
You can launch any of the sub activities in the settings app using something like:
startActivity(new Intent(Settings.ACTION_WIFI_SETTINGS));

How create a Actionbarcompact Settings?

I am developing an application using the Action Bar Compact.
Right now I'm trying to set the Activity Application Preferences.
As Java does not have multiple inheritance can not inherit both ActionBarCompact and Preference Activity.
I need a way to use the two classes at a time, so you can use the Action-bar to navigate and to use Preference Activity activity as Preferences.
PS: My apologies if the question is not clear, my English is not quite good.

How can i list only applications excluding widgets and services in a grid view in Android?

I am able to List all applications using code mentioned on that page.
I want to filter it and just list the applications installed in the grid view.
You have your concepts a bit wrong.
Widgets and services are part of an application, just like the activities are.
Some activities are meant to show in the launcher, that's when you declare them on the manifest with the intent-filter MAIN and DEFAULT.
What you probably want is to get the activities that declare such intent filters.
And how to do it is in the Utilities class of you the link you provided.

First android app for iOS developer

i am iOS app developer. Now when i created an app on iOS i want to do the same on android. With java i was familiar just now need some time to remember.
i was looking at some tutorial how to do one or other things. But what i can't find is the basics how everything works. How classes is interacting with each other.
For example i want to create registration window with few buttons and alerts.
I want registration window to be called just once when app is installed and just that.
Should i create new java class and few layouts, one for View with buttons and other for Alerts ?
Or should i create other class for alerts if i need them in other flow of my app ?
And how i should call that window with registration from my main class, which is
extends Activity
Also if there are some developers who came this road from objective-c (iOS) to java (android). It would be nice for some share experience how they did that.
Thank you for any help :)
Very few of the concepts in iOS and Android are similar. On Android you have Activites, Intendts the Manifest. When you design your layout it should be resolution independent. You have a search, back and a menu button and variable hardware. All of this has no equivalent in iOS.
That said, I think you just have to read the basic concepts and the getting started guide no matter if you come from iOS or never have done mobile development before.
EDIT
To answer your concrete question. Take a look at the lifecycle of an Activity and Preferences. With this, you could do some action on the first start of your main Activity and store some flag in the preferences when it's done. On the next start you just test that preference and skip the logic.
You can create one activity (.java file) and one layout(.xml file with buttons and input boxes) , alerts could be toast notifications:
http://developer.android.com/guide/topics/ui/notifiers/toasts.html
All you require for this is a activity and a layout xml for that activity, this activity will be your main ie the entry point to your application, in that activity oncreate method you can check if it is registered or not by setting a flag or something which will direct to the next activity if its registered.
GOOD LUCK...
Just like your nibs in iPhone you create xml layouts in Android. And for view controllers here you make activity. One important thing is AndroidManifest.xml file, it contains all information of your app (like plist) plus all the activity information(Intent type and launcher methods).

Categories