In my Android app there are 3 activities..
1st one has username(textView and EditText),email(textView and EditText),password(textView and EditText)....
2nd one has Alternate number(textView and EditText)
User has to enter all these only once when he starts app for the first time(i.e just once after download) and all these should be saved somewhere in storage..
3rd activity displays all these information together along with device id and sim Number..
so when the user starts the app for the second time,directly 3rd activity should be displayed..How can i do this???
The manifest could make the 3rd Activity as the initial one. In the 3rd Activity's onCreate, check from SharedPreferences if initialization has taken place. If not, start 1st Activity. If yes, continue normally.
There are multiple options to store informations for your app like :
Shared Preferences
Internal Storage
External Storage
SQLite Databases
Network Connection
Related
I want input data in internal storage of my app when my app installed in new device & never change(delete & update &insert). my information is heavy & if I input my information in oncreate() every time that user open my app information will be make again & I don't like it.how can I do it?
Create a class that is a Broadcastreceiver and register it in your manifest to receiver Intent.ACTION_PACKAGE_INSTALL actions. It will be called only when the application is installed.
You can use assets folder and put your heavy data there. It will be installed with application package. You can find information about that here.
I am new to android development. I know we can check for application first run using preferences. But My Question is - If it is first run i should get a First(splash) form where i should get a string and save it in SQLite(Database). Second time i should check the database if the string exists I should get the Second(Login) form. I tried many ways its not working.
Can any one help me out with a detailed code. Thanks in Advance.
Why don't you just write an if else statement in the main method of the main page?
If first launch > splashscreen redirect
If run xx > Login redirect.
To detect the first time an app is launched you could make a sharedPreference (see this thread: How to use SharedPreferences in Android to store, fetch and edit values or Check if application is on its first run)
Good luck.
Define a startup activity without a view, and in its onCreate method, check (using SharedPreferences) if this is the first run. If so, go to the splash screen, otherwise go to the login screen.
I've created an app that has been in the android marketplace for a few months now. I'm trying to create a complimentary app that will be used inside the first app. I need the second app to be optional, and not necessary for the first app to work properly. I'm hoping to call the main activity from the second app within a Tab Host tab on the first app.
My questions are: how do I run an activity from a secondary app with a different package? Is it possible to have the activity be in a tab host?
I'd be happy to post code, but my code seems to be nowhere close to what I'm trying to get. I don't think I can adjust the build path of the primary app, because the secondary app can't be required. Also, Since the app has been in the marketplace for a while, I can't use SharedUserIds.
Thanks for all help.
TJ
It is not possible to do it to run any arbitrary activity in your app.
I have done this before, with activity group, which has been already deprecated. And there are also limitations to use this approach:
Your app has the same UID with the target package.
Your app has system UID
If you met either condition list above, you can start the child activity and get its window root view, and add into your layout.
I've been searching and I couldn't find a topic that could clarify me 100%.
My question is: How can I launch an android's app preferences activity (from Contacts, Messages, ...) on my own app?
I give an example:
Imagine I'm developing an app which allows the user to quickly access to Message's Settings. I don't need to send or receive any information, I only need to open the activity, create a shortcut for it.
Someone knows if this can be done and even opening specific locations of the apps?
You don't need to know any specific locations or specific apps for these actions, simply look into Intent.ACTION_PICK.
Picking a Contact: get contact info from android contact picker
Picking a picture: How to pick an image from gallery (SD Card) for my app?
The best answer in this thread has the solution:
android: how do i open another app from my app?
Also check:
http://android-developers.blogspot.com/2009/01/can-i-use-this-intent.html
To open settings, you can try:
startActivityForResult(new Intent(android.provider.Settings.ACTION_SETTINGS, 0));
There is no difference in writing in code an Explicit Intent which will go to a specific activity of your app and using the same format to go to a specific activity some other app. A few things to be aware of: (1) The receiving activity may be expecting particular data and fail otherwise. (2) The standard apps you are considering like Contacts, Messages while you can find the source for them in the Android Open Source Project (AOSP) may be changed by the manufacturers so that the activity names and necessary extra data could be different.
In order to maintain as much compatibility between all of the different Android manufacturers, you should stick to the standard implicit intent with the appropriate action/data.
I was studying some sample examples for Android and one of them got me really curious:
the NoteList (or Notepad) example application - here
My question is: Is there any way to make a NoteList shortcut, that always starts the application with its 'Editor' activity, for example. [of course if the creator of that 'third-party' application intended to make it possible by describing the entry points of its application in a proper way in the manifest file. I do not intent to create malware.]
in other words:
Can a third-party application (like the one I wish to make :) ) to get to internal application intents {i.e. action, activity, data} or this is handled by Android and no one else?
What gave the idea that this is possible was the following case:
I opened NoteList, created a few note, and when I was editing the title of one of the notes - I pressed HOME, when I clicked on the icon of NoteList I got the exact same state of the application - editing the title of the note.
thanks!
One has nothing to do with the other. That means that reopen an activity which was paused or killed with a data restoring logic just restores the last state. This is what happened in your example.
Now what you mean I guess is if there is a way to tell Android that you application can do a certain thing thus it should be shown as an option in the action chooser. Yes that is possible through intent filters.
The Intent reference page might also be very informative for you.