Why won't my android application open/start? -
when installs app app store, open button (usually found next uninstall button upon installation completion) grayed out, , application cannot found in app drawer.
also, when execute eclipse choosing default activity, says in console installed apk, not start. if select splash activity default activity in run configuration, runs without hitch, still cannot find in app drawer afterwards. help appreciated c:
manifest:
<uses-sdk android:minsdkversion="8" android:targetsdkversion="17" /> <application android:allowbackup="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/apptheme" > <activity android:name="com.meteorfiber.gangnamstyle.splash" android:configchanges="keyboardhidden|orientation|screensize" android:label="@string/app_name" android:screenorientation="portrait" android:theme="@android:style/theme.black.notitlebar.fullscreen" > <intent-filter> <action android:name="com.meteorfiber.gangnamstyle.main" /> <category android:name="android.intent.category.launcher" /> </intent-filter> </activity> <activity android:name="com.meteorfiber.gangnamstyle.mainactivity" android:configchanges="keyboardhidden|orientation|screensize" android:label="@string/app_name" android:screenorientation="portrait" android:theme="@android:style/theme.black.notitlebar.fullscreen" > <intent-filter> <action android:name="com.meteorfiber.gangnamstyle.mainactivity" /> <category android:name="android.intent.category.default" /> </intent-filter> </activity> </application> </manifest>
splash:
package com.meteorfiber.gangnamstyle; import android.app.activity; import android.content.intent; import android.content.sharedpreferences; import android.os.bundle; import android.os.handler; import android.preference.preferencemanager; public class splash extends activity { private final int splash_display_length = 3000; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.splash); } @override protected void onresume() { super.onresume(); sharedpreferences sp = preferencemanager .getdefaultsharedpreferences(this); boolean issplashenabled = sp.getboolean("issplashenabled", true); if (issplashenabled) { new handler().postdelayed(new runnable() { @override public void run() { splash.this.finish(); intent mainintent = new intent(splash.this, mainactivity.class); splash.this.startactivity(mainintent); } }, splash_display_length); } else { finish(); intent mainintent = new intent(splash.this, mainactivity.class); splash.this.startactivity(mainintent); } } }
mainactivity:
package com.meteorfiber.gangnamstyle; import android.app.activity; import android.media.mediaplayer; import android.os.bundle; import android.view.keyevent; import android.view.window; import android.view.windowmanager; public class mainactivity extends activity { mediaplayer oursong; /** called when activity first created. */ @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); getwindow().setflags(windowmanager.layoutparams.flag_fullscreen, windowmanager.layoutparams.flag_fullscreen); requestwindowfeature(window.feature_no_title); setcontentview(new gameview(this)); oursong = mediaplayer.create(mainactivity.this, r.raw.song); oursong.start(); } @override public boolean onkeydown(int keycode, keyevent event) { if (keycode == keyevent.keycode_back) { // preventing default implementation previous // android.os.build.version_codes.eclair homecoming true; } homecoming super.onkeydown(keycode, event); } @override protected void onpause() { // todo auto-generated method stub super.onpause(); oursong.release(); } }
change intent filter starting activity to
<intent-filter> <action android:name="android.intent.action.main" /> <category android:name="android.intent.category.launcher" /> </intent-filter>
the android launcher along settings activity seek find intent-filter in application in order launch activity. if can't found, activity cannot launched typical launcher , won't displayed.
android
No comments:
Post a Comment