I have been developing a map app for Android. Initially I intended to make the main screen the map itself. After discussion with my boss, it has been decided that I make a normal (non-map) layout as my first screen and then have a button to access that map.
I have the first screen ready to be used. The name of this activity is LocateActivty.java. The name of the map activity is MainActivity.java. Since I initially developed the map activity first, it obviously continues to be opened as the first screen.
What changes should I make to the files (if any) and to any configuration files to make LocateActivity.java my main activity?
EDIT - Manifest code
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="com.aquamet.saramap.MainActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="com.aquamet.saramap.LocateActivity"
android:label="#string/title_activity_locate"
android:parentActivityName="com.aquamet.sara.MainActivity" >
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="com.aquamet.sara.MainActivity" />
</activity>
</application>
The lines of XML in the manifest:
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
Need to be moved from the Activity tags for MainActivity, and put inside the tags for LocateActivity. This will then mean that LocateActivity receives the Launcher intent when the user opens your application
Related
Iam trying to add Splash screen to my existing Android Project, which is not MainActivity.Java, but by default Android Studio is executing MainActivity.Java first, So I want to change the Activity Priority so that my SplashActivity.Java will execute first and later Activity's will follow after the Splash Screen.
Make splash activity your launcher activity instead of Main Activity in Android Manifest.
<activity
android:name=".ui.splash.SplashActivity"
android:screenOrientation="portrait"
android:theme="#style/SplashTheme">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
modify your AndroidManifest.xml like this
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.circlefil.reactivetrip">
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:roundIcon="#mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<activity android:name=".MainActivity"/>
<activity android:name=".SplashActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
</application>
</manifest>
You need to add IntentFilter in you splash screen activity and from splash screen activity you have to link your main activity using Intent.
Add following code to your splash screen activity.
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
How ever keeping an entire activity is not the best way to create splash screen. See this for more info: Here
To Start activity first you need to make it Launcher Activity in AndroidManifest.xml file.
<activity
android:name=".StartingActivityName">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
I have an Android widget (it is shown in the list of widgets on the phone, and is not shown in the list of apps). It has a button which launches a pop-up activity.
Now I would like to change the widget so, that it would be both an app (which will be shown in the list of apps on the phone) which will start from that pop-up activity, and a widget (the same as before) which will launch the app (which will consist of that pop-up activity, but will be displayed and treated like an app).
What changes should I make in my manifest file to make the changes described above?
Below is my manifest file:
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="15" />
<uses-permission android:name="android.permission.INTERNET" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#android:style/Theme.Light.NoTitleBar" >
<receiver android:name="myapp.myapp.MyWidgetProvider" >
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
</intent-filter>
<meta-data
android:name="android.appwidget.provider"
android:resource="#xml/demo_widget_provider" />
</receiver>
<receiver
android:name="myapp.myapp.MyWidgetIntentReceiver"
android:label="widgetBroadcastReceiver" >
<intent-filter>
<action android:name="GET_HELP" />
<action android:name="CHANGE_PICTURE" />
</intent-filter>
<meta-data
android:name="android.appwidget.provider"
android:resource="#xml/demo_widget_provider" />
</receiver>
<activity
android:name="myapp.myapp.MainActivity"
android:label="#string/title_activity_main" >
</activity>
<activity
android:name="myapp.myapp.CardsChoice"
android:label="#string/title_activity_choice" >
</activity>
</application>
The solution was rather simple: I just needed to add a Launcher Activity to the app.
This operation consists of 2 steps:
Adding activity definition as a launcher activity to the Manifest
Example:
<activity
android:name="package.package"
android:label="#string/title_activity_main"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
Adding code of the activity (and the layout) to the app.
It is about an class MainActivity and a layout file activity_main.xml
I'm new to Android development and I would like to create an app that can launch a scheduled activity reminders from Google calendar.
I tried to do it with filters intents and it does not work, and I searched unsuccessfully for code examples.
Below is what I've done so far. This code is part of a manifest.
<application
android:icon="#drawable/ic_launcher"
android:label="#string/app_name" >
<activity
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<receiver android:name="MasReceiver" >
<action android:name="android.intent.action.EVENT_REMINDER" />
</receiver>
I suspect that the system can't find MasReceiver. The name you supply for your broadcast receiver in the element has to be fully qualified. The documentation for the receiver element explains this in more detail.
So, I am going over tutorials to learn android and I have the bellow code which is giving me this warning in the title and the app will not run for some reason any help?
This is the code:
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="com.example.learn.tam.Splash"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.SPLASH" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="com.example.learn.tam.StartingPoint"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.STARTINGPOINT" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
</application>
The part that is showing the error is the Second
< activity
You are advertising that any application on the device can start com.example.learn.tam.StartingPoint, and Lint is warning you that this is insecure.
Most likely, you do not need that <intent-filter> -- you only usually need those for activities that you are expecting other apps to start. Hence, the simplest way to get rid of this warning is to delete that <intent-filter> and use an explicit Intent when you start that activity (e.g., new Intent(this, StartingPoint.class)).
If you elect to keep the <intent-filter>, for whatever reason, please:
Do not use android.intent.action. as the prefix for your own invented actions -- come up with something else, such as com.example.learn.tam.
Add android:exported="false" to the <activity> element to say that, despite the fact that you have an <intent-filter>, you are not expecting other applications to start your activity
Hi I have created a splash screen but I am not sure how to get it to start. I have tried putting it in the top folder but I can't get it to start, I realise this is because it is the last item I created on my app.
How do I get it to the top of the build path.
Have you placed your Splashscreen in your manifest.
Should place your Splashscreen as the first activity and then the main activity.
For eg:
//First Activity as Splashscreen
activity android:name=".SplashScreen"
android:screenOrientation="portrait"
android:label="#string/app_name"
android:theme="#android:style/Theme.NoTitleBar.Fullscreen">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
//Splashscreen activity ends here
Your main activity followed by remaining activities.
<activity android:name=".Aptv"
android:label="#string/app_name"
android:theme="#android:style/Theme.NoTitleBar.Fullscreen"
android:screenOrientation="portrait">
<intent-filter>
action android:name="com.ayansys.aptv.Aptv" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>