What's the steps of creating & Open new Screen in Android.
I am using Eclipse IDE
What i mean by new screen is when i click on button it will take me to next screen(layout)
I assume you mean Activities by "new screens". Well:
With the new ADT v. 20 it is very easy. Right-click on your project and then click on new -> other:
Click on Android Activity:
Now Name your Class
Start the Activity from your first Activity (from a Button etc.) like this:
Intent i = new Intent(firstActivity.this, secondActivity.class);
startActivity(i);
Isn't it obvious to look up for Google guideline before asking here?
http://developer.android.com/training/basics/firstapp/index.html
Related
I am trying to help my users to turn on their GPS like this:
Intent gpsOptionsIntent = new Intent(
android.provider.Settings.ACTION_LOCATION_SOURCE_SETTINGS);
startActivity(gpsOptionsIntent);
The problem is that it opens the android settings as it was a view from my app, but I want to open it as a new application (android default settings aplication), in other words, outside my app.
Does anyone know how to accomplish what I want?
Thanks!
The code you are executing shows a new activity "on its own app process", if the activity you are calling is not in your application project it mean's that is not in your application context, so my thought is that just because you go back and fall down in the last activity shown you may think is in your app, but that's not the case, the activity is running on it's own process and because of the back stack you are going back to your previous activity.
Hope this Helps.
Regards!
The problem is that it opens the android settings as it was a view from my app,
No it doesn't. It's starting an Activity which is part of the Android Settings app.
but I want to open it as a new application (android default settings aplication), in other words, outside my app.
That's exactly what is happening - it's just opening the Activity which deals with the settings for Location Services rather than opening the default Settings root page.
Don't confuse the generic terms 'app' and 'application' with Android classes such as Application and Activity.
Android is meant to be modular - even though it looks like the Activity which is started with your code is part of your own 'app', in reality what happens is an instance of the native Settings app is created and the Location Services Activity is displayed. This happens entirely outside of your app.
As mentioned in this answer and comment, you need to add intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
Intent gpsOptionsIntent = new Intent(
android.provider.Settings.ACTION_LOCATION_SOURCE_SETTINGS);
// add the following line
gpsOptionsIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(gpsOptionsIntent);
I am new to corona. I wanted to know how to create a new android activity in corona like in eclipse I used
Intent i= new Intent(this,new.class);
startActivity(i);
How do we do this in corona ? so that when i press back button, I go back to previous screen and so that the new activity is a new screen altogether?
you can use storyboard for corona to go to another scene which is Intent going to another Activity in android and for handling back button for android device refer to this link
for storyboard please refer to this link
I'm pretty new to Android applications. What I have at the moment is an "app", which displays a login screen, and users can log in. What I want is, if the login is correct, to "forward" or open a new window, where users can change some settings etc... So really, I only need help with creating a new window.
How would one do that? Make a new activity perhaps?
Thanks
That's right, you just start a new activity with startActivity()
Intent intent = new Intent();
intent.setClass(this,SecondActivity.class);
startActivity(intent);
This means the class you come from, so the current one. SecondActivity is the activity you want to start.
I am thinking, how to set up the new window in Android after pressed button. I have the first window, when I have a few buttons. After pressed one of these buttons (for example on the button for adding new name) I want to show new window, when will be only Edit text for new name...
Any ideas, how is possible to do or where to search inspiration?
Thanks a lot,
Manny
You need to start new activity.
Intent i = new Intent(ActualActivity.this,ActivityB.class);
String name = "example"
i.putExtra("NAME", name);
startActivityForResult(i, ID);//or startActivity,see javadoc for your preferences
With "startActivity" or "startActivityForResult" you call the new activity. For that you need to create a "Intent". If you want to send information like a name, or a number or something else you can "putExtra" information like the example.
(Ofc ActivityB must to extend Activity and must be declare in AndroirManifest)
EDIT:
You have a lot of example of how to start new activity in the SDK examples (sdk directory/samples/android X )
How to open Settings>About page programmaticlly in Android.
You can open it by simply using an Intent
Intent aboutPhone = new Intent(Settings.ACTION_DEVICE_INFO_SETTINGS);
startActivity(aboutPhone);
As in Android there are many Settings classes and here it would be :
android.provider.Settings
Looks like this is as close as you can get
Intent i = new Intent(Settings.ACTION_SETTINGS);
startActivity(i);
Takes you to the main settings page. There doesn't seem to be an option to go to the About Phone page.
Short answer you can't .
Long answer all you can do is create an activity and show all the info from about page in your activity by problematically polling out the info from the system