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
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);
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
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'm new to android. Please tell me how to navigate to a new page in android.
Thanks in advance.
Edit:How to start a new activity from an existing activity
In android to navigate to another page means you have to start another activity. for starting a new activity use this
Intent intent = new Intent(currentActivity.this, nextActivity.class);
startActivity(intent);
You should mention the next activity in the AndroidManifest file.
To change your page (i think you're refering to "Activities" in android you need to issue a so called "intent").
You cann do that by:
startActivity(new Intent(nextactivity,NextActivity.class));
or
startActivityForResult(new Intent(nextactivity,NextActivity.class),1);
if you want the new Activity to return any result to the activity who started the new one.
But what i recommend is, that you read this documentation here:
http://developer.android.com/guide/topics/intents/intents-filters.html
and come back to this question if you have need additional assistance on concrete problems on that topics.
i hope that helps.
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