android tutorial - Basic Activity structure in Android Activity | Developer android - android app development - android studio - android app developement
Basic Activity structure
- Activity is the root UserInterface in Android and have it's own life-cycle.
MainActivity.java
public class MainActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Toast.makeText(this, "Activity created sucessfully!", Toast.LENGTH_LONG).show();
}
}
click below button to copy code from our android learning website - android tutorial - team
- AndroidManifest.xml (should be edited)
<manifest ... >
<application ... >
<activity
android:name=".MainActivity"
android:theme="@android:style/Theme.AppCompat">
</activity>
</application>
</manifest>