forked from dotnet/android-samples
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Start and Final solutions for ActivityLifecycle topic.
- Loading branch information
Mark McLemore
committed
Sep 4, 2015
1 parent
5ca8ad6
commit 41f13b5
Showing
24 changed files
with
362 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
ActivityLifecycle/ActivityLifecycle_Final/Properties/AndroidManifest.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="ActivityLifecycle.ActivityLifecycle" android:versionCode="1" android:versionName="1.0"> | ||
<uses-sdk android:minSdkVersion="19" /> | ||
<application android:label="ActivityLifecycle" android:icon="@drawable/Icon"></application> | ||
</manifest> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
Binary file added
BIN
+5.45 KB
ActivityLifecycle/ActivityLifecycle_Final/Resources/drawable/Icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
ActivityLifecycle/SecondActivity.cs → ...ActivityLifecycle_Final/SecondActivity.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
namespace ActivityLifecyle | ||
namespace ActivityLifecycle | ||
{ | ||
using Android.App; | ||
using Android.OS; | ||
|
68 changes: 68 additions & 0 deletions
68
ActivityLifecycle/ActivityLifecycle_Start/ActivityLifecycle.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<PropertyGroup> | ||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | ||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | ||
<ProductVersion>10.0.0</ProductVersion> | ||
<SchemaVersion>2.0</SchemaVersion> | ||
<ProjectGuid>{B4994EC0-5A8F-4D29-BF89-BE5C9E657438}</ProjectGuid> | ||
<ProjectTypeGuids>{EFBA0AD7-5A72-4C68-AF49-83D382785DCF};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> | ||
<OutputType>Library</OutputType> | ||
<RootNamespace>ActivityLifecycle</RootNamespace> | ||
<MonoAndroidResourcePrefix>Resources</MonoAndroidResourcePrefix> | ||
<MonoAndroidAssetsPrefix>Assets</MonoAndroidAssetsPrefix> | ||
<AndroidResgenClass>Resource</AndroidResgenClass> | ||
<AndroidApplication>True</AndroidApplication> | ||
<AndroidResgenFile>Resources\Resource.designer.cs</AndroidResgenFile> | ||
<AssemblyName>ActivityLifecycle</AssemblyName> | ||
<AndroidManifest>Properties\AndroidManifest.xml</AndroidManifest> | ||
<AndroidUseLatestPlatformSdk>False</AndroidUseLatestPlatformSdk> | ||
<TargetFrameworkVersion>v5.0</TargetFrameworkVersion> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> | ||
<DebugSymbols>True</DebugSymbols> | ||
<DebugType>full</DebugType> | ||
<Optimize>False</Optimize> | ||
<OutputPath>bin\Debug</OutputPath> | ||
<DefineConstants>DEBUG;</DefineConstants> | ||
<ErrorReport>prompt</ErrorReport> | ||
<WarningLevel>4</WarningLevel> | ||
<ConsolePause>False</ConsolePause> | ||
<AndroidLinkMode>None</AndroidLinkMode> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> | ||
<DebugType>none</DebugType> | ||
<Optimize>True</Optimize> | ||
<OutputPath>bin\Release</OutputPath> | ||
<ErrorReport>prompt</ErrorReport> | ||
<WarningLevel>4</WarningLevel> | ||
<ConsolePause>False</ConsolePause> | ||
<AndroidUseSharedRuntime>False</AndroidUseSharedRuntime> | ||
<AndroidLinkMode>SdkOnly</AndroidLinkMode> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<Reference Include="System" /> | ||
<Reference Include="System.Xml" /> | ||
<Reference Include="System.Core" /> | ||
<Reference Include="Mono.Android" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<Compile Include="MainActivity.cs" /> | ||
<Compile Include="Resources\Resource.designer.cs" /> | ||
<Compile Include="Properties\AssemblyInfo.cs" /> | ||
<Compile Include="SecondActivity.cs" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<None Include="Resources\AboutResources.txt" /> | ||
<None Include="Assets\AboutAssets.txt" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<AndroidResource Include="Resources\layout\Main.axml" /> | ||
<AndroidResource Include="Resources\values\Strings.xml" /> | ||
<AndroidResource Include="Resources\drawable\Icon.png" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<Content Include="Properties\AndroidManifest.xml" /> | ||
</ItemGroup> | ||
<Import Project="$(MSBuildExtensionsPath)\Novell\Novell.MonoDroid.CSharp.targets" /> | ||
</Project> |
26 changes: 26 additions & 0 deletions
26
ActivityLifecycle/ActivityLifecycle_Start/ActivityLifecycle.sln
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio 2013 | ||
VisualStudioVersion = 12.0.21005.1 | ||
MinimumVisualStudioVersion = 10.0.40219.1 | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ActivityLifecycle", "ActivityLifecycle.csproj", "{B4994EC0-5A8F-4D29-BF89-BE5C9E657438}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{B4994EC0-5A8F-4D29-BF89-BE5C9E657438}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{B4994EC0-5A8F-4D29-BF89-BE5C9E657438}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{B4994EC0-5A8F-4D29-BF89-BE5C9E657438}.Debug|Any CPU.Deploy.0 = Debug|Any CPU | ||
{B4994EC0-5A8F-4D29-BF89-BE5C9E657438}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{B4994EC0-5A8F-4D29-BF89-BE5C9E657438}.Release|Any CPU.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
GlobalSection(MonoDevelopProperties) = preSolution | ||
StartupItem = ActivityLifecycle.csproj | ||
EndGlobalSection | ||
EndGlobal |
19 changes: 19 additions & 0 deletions
19
ActivityLifecycle/ActivityLifecycle_Start/Assets/AboutAssets.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
Any raw assets you want to be deployed with your application can be placed in | ||
this directory (and child directories) and given a Build Action of "AndroidAsset". | ||
|
||
These files will be deployed with you package and will be accessible using Android's | ||
AssetManager, like this: | ||
|
||
public class ReadAsset : Activity | ||
{ | ||
protected override void OnCreate (Bundle bundle) | ||
{ | ||
base.OnCreate (bundle); | ||
|
||
InputStream input = Assets.Open ("my_asset.txt"); | ||
} | ||
} | ||
|
||
Additionally, some Android functions will automatically load asset files: | ||
|
||
Typeface tf = Typeface.CreateFromAsset (Context.Assets, "fonts/samplefont.ttf"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
namespace ActivityLifecycle | ||
{ | ||
using Android.App; | ||
using Android.Content; | ||
using Android.OS; | ||
using Android.Util; | ||
using Android.Widget; | ||
|
||
[Activity(Label = "Activity A", MainLauncher = true)] | ||
public class MainActivity : Activity | ||
{ | ||
protected override void OnCreate(Bundle bundle) | ||
{ | ||
Log.Debug(GetType().FullName, "Activity A - OnCreate"); | ||
base.OnCreate(bundle); | ||
SetContentView (Resource.Layout.Main); | ||
FindViewById<Button>(Resource.Id.myButton).Click += (sender, args) => | ||
{ | ||
var intent = new Intent(this, typeof(SecondActivity)); | ||
StartActivity(intent); | ||
}; | ||
} | ||
|
||
protected override void OnDestroy() | ||
{ | ||
Log.Debug(GetType().FullName, "Activity A - On Destroy"); | ||
base.OnDestroy(); | ||
} | ||
|
||
protected override void OnPause() | ||
{ | ||
Log.Debug(GetType().FullName, "Activity A - OnPause"); | ||
base.OnPause(); | ||
} | ||
|
||
protected override void OnRestart() | ||
{ | ||
Log.Debug(GetType().FullName, "Activity A - OnRestart"); | ||
base.OnRestart(); | ||
} | ||
|
||
protected override void OnResume() | ||
{ | ||
Log.Debug(GetType().FullName, "Activity A - OnResume"); | ||
base.OnResume(); | ||
} | ||
|
||
protected override void OnStart() | ||
{ | ||
Log.Debug(GetType().FullName, "Activity A - OnStart"); | ||
base.OnStart(); | ||
} | ||
|
||
protected override void OnStop() | ||
{ | ||
Log.Debug(GetType().FullName, "Activity A - OnStop"); | ||
base.OnStop(); | ||
} | ||
} | ||
} |
5 changes: 5 additions & 0 deletions
5
ActivityLifecycle/ActivityLifecycle_Start/Properties/AndroidManifest.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="ActivityLifecycle.ActivityLifecycle" android:versionCode="1" android:versionName="1.0"> | ||
<uses-sdk android:minSdkVersion="19" /> | ||
<application android:label="ActivityLifecycle" android:icon="@drawable/Icon"></application> | ||
</manifest> |
28 changes: 28 additions & 0 deletions
28
ActivityLifecycle/ActivityLifecycle_Start/Properties/AssemblyInfo.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
using System.Reflection; | ||
using System.Runtime.CompilerServices; | ||
using Android.App; | ||
|
||
// Information about this assembly is defined by the following attributes. | ||
// Change them to the values specific to your project. | ||
|
||
[assembly: AssemblyTitle("ActivityLifecycle")] | ||
[assembly: AssemblyDescription("")] | ||
[assembly: AssemblyConfiguration("")] | ||
[assembly: AssemblyCompany("")] | ||
[assembly: AssemblyProduct("")] | ||
[assembly: AssemblyCopyright("")] | ||
[assembly: AssemblyTrademark("")] | ||
[assembly: AssemblyCulture("")] | ||
|
||
// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}". | ||
// The form "{Major}.{Minor}.*" will automatically update the build and revision, | ||
// and "{Major}.{Minor}.{Build}.*" will update just the revision. | ||
|
||
[assembly: AssemblyVersion("1.0.0")] | ||
|
||
// The following attributes are used to specify the signing key for the assembly, | ||
// if desired. See the Mono documentation for more information about signing. | ||
|
||
//[assembly: AssemblyDelaySign(false)] | ||
//[assembly: AssemblyKeyFile("")] | ||
|
Oops, something went wrong.