Pure Java and Android Application

11

I'm a beginner in Java. I preferred to start studying pure Java, that is, I discarded studying through dragging components. I knew JavaFX; I preferred to study the construction of these components at hand as well. I learned many things, many even. I made some applications for desktop , but I did not like the difficulty in security and sale of those applications; so decide to start making apps for Android.

My questions are:

How do I use my Java and JavaFX knowledge on Android?

For example, I learned to navigate between screens in very interesting ways, but on Android, will it matter?

In other words, can you program in Android in a pure way, without having to drag components all the time?

    
asked by anonymous 06.08.2015 / 14:33

3 answers

7

If you already know / have knowledge in Java, it will be easier with Android, since in Android Studio you will work with java .. (You can also develop using C # and JavaScript).

Regarding interfaces, on Android, they are XML files. Then you can either drag the components and position them where they are needed or create them using only the codes.

For example: You can drag the components to create the screen by

Or, you can write all the xml. For the example above, it would look like this:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" >

    <TextView
        android:id="@+id/textView1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="TextView" />

    <EditText
        android:id="@+id/editText1"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:ems="10" >

        <requestFocus />
    </EditText>

    <Button
        android:id="@+id/button1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Button" />

    <ImageView
        android:id="@+id/imageView1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:src="@drawable/configuracoes" />

</LinearLayout>

I'll leave some references here for study:

Android Developer

Book: Google Android - 4th Edition

Book: Google Android: create mobile and tablet applications

    
06.08.2015 / 14:50
7

Android development, allows you to "drag" the components to the screen, I particularly do not like to do this, but the development of screens on android is very intuitive.

How do I use my Java and JavaFX knowledge on Android?

The native android development is done through the Java language so what you have learned you can apply easily, in JavaFx we put actions for the buttons:

myNode.setOnMouseClicked(new EventHandler<MouseEvent>()

In android there is an almost identical way where we can add a method to our buttons in the same way

btEntrar.setOnClickListener(new View.OnClickListener()

For example, I learned to navigate between screens in very interesting ways, but on Android, will it matter?

Again Android studio is just an IDE, in android the navigation between the screens is done through INTENTS , where you create an intention to start the new screen through some event or success in data validation.

In other words, do you have to program in Android in a pure way, without having to drag components all the time?

As I mentioned in the first question, it is possible that you create your layouts and within them you can put any component you want in the hand or do it by programming directly in Java.

Example of some of the most familiar components:

EditText : displays a field for the user to enter values can be defined attributes, such as only numbers or text, size, colors among others.

Button : Displays a button for the user, it has several properties that can be easily worked on.

TextView : Works as a label

The books that emanuelsn quoted are very didactic and can help you in this stage of adaptation, here in SOpt we also have several questions already answered related to tag Android .

Components Palette in Android Studio

Tousejustexpandanddragthedesiredcomponent.

Documentation

    
06.08.2015 / 15:14
0

Look, in fact your knowledge in java will tell you a lot, because Android is based on java this and its concept of object orientation, but the part of the layout is based on XML, basically you should only learn interconnect! And I advise you first to read about the life cycle and the threads that exist on Android. Any questions about implementing something here are in.

    
06.08.2015 / 14:43