Wednesday, 18 February 2015

Android back from a Child Activity started by a Fragment

If you want to back from a child activity to Fragment put the following code in your Manifest File



 <activity
           android:name="com.assests.AssestsActivity"  //Parent Fragment Activity
           android:label="Assests"
           android:launchMode="singleTop" 
           android:parentActivityName="com.docx.HomeScreen" //Parent activity 
           android:screenOrientation="portrait" >
 </activity>



Below Manifest code is for ChildActivity


  <activity
            android:name="com.assests.VechicelsDetails"  //Child Activity
            android:label="Vechicels"
            android:parentActivityName="com.assests.AssestsActivity"
            android:screenOrientation="portrait" >
  </activity>
   <activity
            android:name="com.assests.DepositsDetails"  //Child Activity
            android:label="Deposits"
            android:parentActivityName="com.assests.AssestsActivity"
            android:screenOrientation="portrait" >
 </activity>

If you click any child activity, it will go to the particular fragment