How to perform some action when my Android app is launched -
i creating android app. want voice sort of message execute when app launches . have figured out message part using text speech, cannot execute automatically on app startup.can me out ?
if want execute code once wehn app starts 1 possible solution: public class myapp extends application {
public myapp() { // method fires once per application start. // getapplicationcontext returns null here log.i("main", "constructor fired"); } @override public void oncreate() { super.oncreate(); // method fires once constructor // application has context here log.i("main", "oncreate fired"); } }
then should register class application class inside androidmanifest.xml
<application android:label="@string/app_name" android:name=".myapp"> <------- here <activity android:name="myactivity" android:label="@string/app_name"> <intent-filter> <action android:name="android.intent.action.main"/> <category android:name="android.intent.category.launcher"/> </intent-filter> </activity> </application>
Comments
Post a Comment