I try to implement the Android UI template - android

i try to use the List View from this template
http://codecanyon.net/item/material-design-ui-android-template-app/9858746
i get the source code
but i need the steps of how i can implement the list view in android studio ?

you should follow the documentation of the template , as the vendor states :
You can easily implement components from Android UI template just by
following our huge and well organized documentation.

Related

Android studio kotlin, cannot directly select ID without findViewById()

I'm new to android studio and I'm leaning it from this video
At 50:45 he says that we can directly use the id without findViewById (), for him it shows just import that Id, but when I tried the same I'm not getting what he is getting. Can anyone tell me what's wrong, is that feature removed in the latest update??
"kotlinx.android.synthetic is no longer a recommended practice. Removing in favour of explicit findViewById"
So, this feature`s been deprecated almost a year ago.
The new recommended way of working with view tree is View Binding.
Or you could write some lazy extension function that uses findViewById under the hood.
You can use the Kotlin Android Extensions check here or with the help of data binding or view binding you can just use the id directly in to your java activity class
The way you're talking about is Kotline Extensions for view, for which you apply it in the build.gradle file using apply plugin: 'kotlin-android-extensions', sync the project as prompted by the Android studio and it starts working.
But, Kotlin extensions has also been deprecated for view binding which is null-safe, also easy to implement and better.
To read about view binding, read the Android documentation on ViewBinding here and about migrating here. You can also go with this article to help with setting up Android view binding.

How to translate a native android sdk's usage instructions to Nativescript

We're having a hard time taking the first step in using a native library in NativeScript.
It's a Map library so I assume it has something to do with registering a new custom UI, but what gets me is the weird xml syntax.
The follow screenshots are from this page : https://developers.arcgis.com/android/latest/guide/develop-your-first-map-app.htm
Native instructions are for Android Studio :
The dependencies (Gradle) :
It also has a weird dependency for Java 8 features :
And lastly, the basic usage, which seems to require lots of platform specific native events :
For now we're only interested in an Android Proof of Concept, but eventually make and release a multi-platform plugin.
I know it's a lot of instructions and things asked for just one question, but here are our main confusions :
1) How to add the custom element to a NativeScript xml? Do we just set up the gradle imports and just add the following element directly? Also i'm assuming the android:id is unnecessary and we can just use id
<com.esri.arcgisruntime.mapping.view.MapView
android:id="#+id/mapView"
android:layout_width="match_parent"
android:layout_height="match_parent" >
</com.esri.arcgisruntime.mapping.view.MapView>
2) How to access the above element by its ID via Javascript? More specifically how to get it using VUE? Native Example :
import com.esri.arcgisruntime.mapping.view.MapView;
MapView = findViewById(R.id.mapView);
ArcGISMap map = new ArcGISMap(Basemap.Type.TOPOGRAPHIC, 34.056295, -117.195800, 16);
mMapView.setMap(map);
3) Are there any other steps we need to take into consideration? Specially considering we intend into making this into a full plugin eventually. Or is this more straightforward/simple than I'm making it?
Ignore the XML example from the SDK docs, that is specific to Android's XML markup.
You have to create a new class (let's call it MapView), extending the base class View (from tns-core-modules/ui/core/view), in the createNativeView callback return instance of com.esri.arcgisruntime.mapping.view.MapView. That's should be it, now you can register the MapView class and use it in your Vue template.
Useful docs:
Building Plugins
Marshalling Java to JS

Can I design the UI in Xamarin.Forms by using XAML

I'm trying to create a cross platform app using Xamarin.Forms. As far as I know, the UI will be created from the code and the .axml file will be generated automatically.
Can I modify the .axml file to edit the UI? I tried editing but all that comes up is what is written in the code. ie: hello forms
UPDATE
public static Page GetMainPage ()
{
return new simplerow ();
}
In Xamarin.Forms you can create your pages from markup definitions that are shared across all platforms.
Typically you will write all your content pages using Xamarin.Forms, however you can mix-and-match native pages into an application should you so wish.
These shared common pages, written in Xamarin.Forms, will reside maybe in a PCL project, or a Shared Project so these can then be re-used in the platform-specific projects, each targeting a specific platform OS.
You can write these common pages, either in code, or in XAML. You can even choose to write some pages one way, and some the other if you so choose.
A Xamarin.Forms page is processed at runtime through the interpretation of the page composition that has been created.
Each control that is specified on a page, has its own platform specific renderer, behind the scenes, that will produce output that is targetted to that OS.
When writing Xamarin.Forms pages, for-the-most, you will start to learn a new way of creating pages that is abstracted from the intricacies of creating mobile applications on each different platform OS.
There is therefore no editable .axml that is generated etc as you will write your pages using Xamarin.Forms markup and controls, and even your own or other custom-controls to produce your own application pages.
The following link shows some examples of how to write XAML pages.
The following link shows some examples of how to write from code-behind pages.
Along with the previous answer re: .xaml instead of .axml, you need to remember to change the startup code in app.cs to use your new .xaml form. Replace the "new ContentPage {...};" with "new MyForm();" (where "MyForm" is the name of your shiny new XAML form).
EDIT: Downloaded the project from the dropbox link. Comments below...
I see several issues here. I think you may need to go through the walkthroughs and sample applications provided by Xamarin to get up to speed with the concepts behind XF apps.
First, you are trying to use an Activity as your application's page. In a Xamarin Forms app, it must be a View of some sort, not a platform-specific visual such as Activity.
Second, remove the "test.xml" file from your Android project's Resources/layout folder; while XAML files are indeed XML, they have an 1) have a file extension of .xaml and 2) belong in the shared project.
Here's what you need to do to get your project working: (I'm assuming you're using VS here, under Xamarin Studio, it's slightly different.)
Right-click your "testforms" shared project
Click Add from the context menu and select "New Item"
In the dialog that appears, select "Forms XAML Page" and in the Name area enter a name (such as "MyForm")
(If you're using XS, choose "New File" and "Forms ContentPage")
This will add two files to your project: a XAML file containing your layout (e.g.: MyForm.xaml), and a code-behind file (e.g.: MyForm.xaml.cs).
Open the XAML file, and modify the Label element so that the Text attribute is
Text = "Hello, World!"
Modify the body of GetMainPage in your App.cs to the following:
return new MyForm();
Run the app
Hope this helps!
You got it wrong. Forms are created either through code or XAML. No axml or anything persistent is generated at platform level, everything is done in runtime(XAML is sort of compiled at compile time).
So, modify either code or XAML if you wish to change something. Or, if you need something more demanding, than consider either subclassing an existing Renderer or create you own.

Does Android SDK suggested with MVP design pattern?

I've read about MVP design pattern and have some question about it.
If we consider Android SDK we can suggest that an Activity is a Presenter which takes over event handling, lifecycle events executing and communication with data-layer which can be a SharedPreferences, SQLlite etc. View in that case is just xml- view description which doesn't contain any event handlers or other user-communication things.
But I'm doubt if my reasoning correct at all? Could you help me to understand?
Android also follow MVC architecture.
1) In Android activity is the controller where you write a code for handling input & response.
2) xml layouts represent the view where you describe the presentation part of the application.
3) & model is your java pojo classes. For instance Person class which has two attributes first name & last name.

Android: Is there a Tree Package (Datastructure) I can use?

I'm trying to convert a Java Program to Android. I created a new xml Interface and most of the core logic is still running but since Swing is not present in Android i'm missing the class javax.swing.tree.DefaultMutableTreeNode in particular.
Is there an easy way to replace the class with something equivalent in Android?
Thanks in advance!
Taber
There is no Tree view on Android, so there is no directly comparable class.
But, if you need to use a tree-like data structure to display it's data in UI, for example in ExpandableListView, then you can use CursorTreeAdapter.

Categories

Resources