(q) my application wont work unless i click on it from another launcher


  1. powerpoint45

    powerpoint45 Well-Known Member

    Ive gotten pretty far on my own launcher.I used this code to make it so when you click home your launcher appears:

    <activity
    android:label="@string/app_name"
    android:name=".yourclassname.java" >
    <intent-filter >
    <action android:name="android.intent.action.MAIN" />
    <category
    android:name="android.intent.category.HOME" />
    <category
    android:name="android.intent.category.DEFAULT" />
    </intent-filter>
    </activity>

    This works but when i reboot and click on my launcher from the dialogue that pops up to select your launcher, it force closes. To fix this temporarily i just click on my app from a different launcher. Anyone have an idea on how to fix this? THANKS

    Advertisement
  2. jiminaus

    jiminaus Well-Known Member

    If you actually have android:name=".yourclassname.java" in your AndroidManifest.xml, that will be the problem.

    But instead of fixed that, I think you have a more fundamental structural problem in your AndroidManifest.xml.

    You want the same activity to start in both cases right? Then you just have one acitivity with multiple sets of intent-filters.

    Move the stuff between <intent-filter> ... </intent-fitler> to inside the activity with the MAIN and LAUNCHER intent-filter.

    For example:
    Code:
    <activity
        android:label="@string/app_name"
        android:name=".MyLauncherHomeActivity" >
    
      <intent-filter >
        <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.LAUNCHER" />
      </intent-filter>
    
      <intent-filter >
        <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.HOME" />
        <category android:name="android.intent.category.DEFAULT" />
      </intent-filter>
    
    </activity>
    
    alostpacket and powerpoint45 like this.
  3. powerpoint45

    powerpoint45 Well-Known Member





    You are a very smart person.I thank you so much...it works like a charm.I love the quick replies..that's why i like this website more than xda

Share This Page