Skip to content

Commit 6527796

Browse files
author
AjitAk
committed
Added GenerateDataFormItemsForDataObject sample in this repository
1 parent 277bc30 commit 6527796

File tree

93 files changed

+31679
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

93 files changed

+31679
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
Any raw assets you want to be deployed with your application can be placed in
2+
this directory (and child directories) and given a Build Action of "AndroidAsset".
3+
4+
These files will be deployed with you package and will be accessible using Android's
5+
AssetManager, like this:
6+
7+
public class ReadAsset : Activity
8+
{
9+
protected override void OnCreate (Bundle bundle)
10+
{
11+
base.OnCreate (bundle);
12+
13+
InputStream input = Assets.Open ("my_asset.txt");
14+
}
15+
}
16+
17+
Additionally, some Android functions will automatically load asset files:
18+
19+
Typeface tf = Typeface.CreateFromAsset (Context.Assets, "fonts/samplefont.ttf");

Xamarin.Forms/GenerateDataFormItemsForDataObject/GenerateDataFormItemsForDataObject.Android/GenerateDataFormItemsForDataObject.Android.csproj

Lines changed: 236 additions & 0 deletions
Large diffs are not rendered by default.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#region Copyright Syncfusion Inc. 2001-2018.
2+
// Copyright Syncfusion Inc. 2001-2018. All rights reserved.
3+
// Use of this code is subject to the terms of our license.
4+
// A copy of the current license can be obtained at any time by e-mailing
5+
// [email protected]. Any infringement will be prosecuted under
6+
// applicable laws.
7+
#endregion
8+
using System;
9+
10+
using Android.App;
11+
using Android.Content.PM;
12+
using Android.Runtime;
13+
using Android.Views;
14+
using Android.Widget;
15+
using Android.OS;
16+
17+
namespace GenerateDataFormItemsForDataObject.Android
18+
{
19+
[Activity(Label = "GenerateDataFormItemsForDataObject", Icon = "@drawable/icon", Theme = "@style/MainTheme", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)]
20+
public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsAppCompatActivity
21+
{
22+
protected override void OnCreate(Bundle bundle)
23+
{
24+
TabLayoutResource = Resource.Layout.Tabbar;
25+
ToolbarResource = Resource.Layout.Toolbar;
26+
27+
base.OnCreate(bundle);
28+
29+
global::Xamarin.Forms.Forms.Init(this, bundle);
30+
LoadApplication(new App());
31+
}
32+
}
33+
}
34+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.Syncfusion.GenerateDataFormItemsForDataObject">
3+
<uses-sdk android:minSdkVersion="27" />
4+
<application android:label="GenerateDataFormItemsForDataObject.Android"></application>
5+
</manifest>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
#region Copyright Syncfusion Inc. 2001-2018.
2+
// Copyright Syncfusion Inc. 2001-2018. All rights reserved.
3+
// Use of this code is subject to the terms of our license.
4+
// A copy of the current license can be obtained at any time by e-mailing
5+
// [email protected]. Any infringement will be prosecuted under
6+
// applicable laws.
7+
#endregion
8+
using System.Reflection;
9+
using System.Runtime.CompilerServices;
10+
using System.Runtime.InteropServices;
11+
using Android.App;
12+
13+
// General Information about an assembly is controlled through the following
14+
// set of attributes. Change these attribute values to modify the information
15+
// associated with an assembly.
16+
[assembly: AssemblyTitle("GenerateDataFormItemsForDataObject.Android (LR)")]
17+
[assembly: AssemblyDescription("")]
18+
[assembly: AssemblyConfiguration("")]
19+
[assembly: AssemblyCompany("Syncfusion Inc.")]
20+
[assembly: AssemblyProduct("GenerateDataFormItemsForDataObject.Android")]
21+
[assembly: AssemblyCopyright("Copyright © 2001-2018 Syncfusion Inc.")]
22+
[assembly: AssemblyTrademark("")]
23+
[assembly: AssemblyCulture("")]
24+
[assembly: ComVisible(false)]
25+
26+
// Version information for an assembly consists of the following four values:
27+
//
28+
// Major Version
29+
// Minor Version
30+
// Build Number
31+
// Revision
32+
//
33+
// You can specify all the values or you can default the Build and Revision Numbers
34+
// by using the '*' as shown below:
35+
// [assembly: AssemblyVersion("1.0.*")]
36+
[assembly: AssemblyVersion("16.4.0.42")]
37+
38+
// Add some common permissions, these can be removed if not needed
39+
[assembly: UsesPermission(Android.Manifest.Permission.Internet)]
40+
[assembly: UsesPermission(Android.Manifest.Permission.WriteExternalStorage)]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
Images, layout descriptions, binary blobs and string dictionaries can be included
2+
in your application as resource files. Various Android APIs are designed to
3+
operate on the resource IDs instead of dealing with images, strings or binary blobs
4+
directly.
5+
6+
For example, a sample Android app that contains a user interface layout (main.xml),
7+
an internationalization string table (strings.xml) and some icons (drawable-XXX/icon.png)
8+
would keep its resources in the "Resources" directory of the application:
9+
10+
Resources/
11+
drawable-hdpi/
12+
icon.png
13+
14+
drawable-ldpi/
15+
icon.png
16+
17+
drawable-mdpi/
18+
icon.png
19+
20+
layout/
21+
main.xml
22+
23+
values/
24+
strings.xml
25+
26+
In order to get the build system to recognize Android resources, set the build action to
27+
"AndroidResource". The native Android APIs do not operate directly with filenames, but
28+
instead operate on resource IDs. When you compile an Android application that uses resources,
29+
the build system will package the resources for distribution and generate a class called
30+
"Resource" that contains the tokens for each one of the resources included. For example,
31+
for the above Resources layout, this is what the Resource class would expose:
32+
33+
public class Resource {
34+
public class drawable {
35+
public const int icon = 0x123;
36+
}
37+
38+
public class layout {
39+
public const int main = 0x456;
40+
}
41+
42+
public class strings {
43+
public const int first_string = 0xabc;
44+
public const int second_string = 0xbcd;
45+
}
46+
}
47+
48+
You would then use R.drawable.icon to reference the drawable/icon.png file, or Resource.layout.main
49+
to reference the layout/main.xml file, or Resource.strings.first_string to reference the first
50+
string in the dictionary file values/strings.xml.

0 commit comments

Comments
 (0)