Android Activities

This post contain my all activity related snippet.



#Start new Activity
staring a new activity is very simple. create an intent and pass that intent to startActivity


1
2
Intent i = new Intent(getBaseContext(), ConverterActivity.class);
                startActivity(i);

#Changing Title
set android:label attribute in the activity element


1
2
3
4
5
6
7
<activity android:name=".AboutActivity"
            android:label="About">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

            </intent-filter>
        </activity>

#Close one Activity when switching to other
Add "android:noHistory="true"" to activity in activity element

<activity android:name="skd.app.currencyconverter.MainActivity"    android:label="Currency Converter"    android:noHistory="true">

Comments

Popular posts from this blog

Create Custom View in android MATRIX EFFECT CANVAS tutorial

Xamarin : Simple Calculator Tutorial Visual Studio C#