battle programmers alliance
Would you like to react to this message? Create an account in a few clicks or log in to continue.

battle programmers allianceLog in

the LivinGrimoire Artificial General Intelligence software design pattern forum

descriptionandroid studio walkthroughs Emptyandroid studio walkthroughs

more_horiz
1 hello world
check if you got JDK : window flag, type add remove program, look for
java se development kit (64bit) if not go online search JDK download.
next DL and install :
android studio 64bit

open your mobil device for developing search the walkthrough for your phone.

in the now visible phone developer options (on your phone), enable usb debugging

in android studio (on your computer)
blank or empty activity

deploying an emulator : click the green arrow on the top toolbar, select your usb connected android phone


your activityname.xml tab, design tab, pallette tab, drag drop elements to the phone picture.
such as button, in the text tab now you can see code has been generated for the pallette
you can edit the code or copy paste change it to add palletes with text.
mark select the button, widgets, right click constraint layout, infer constraints

text (double click tab to go bigger screen)

Code:

 <Button
        android:id="@+id/button"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:onClick="topClick"
        android:text="Button"
        tools:layout_constraintTop_creator="1"
        android:layout_marginStart="16dp"
        android:layout_marginTop="26dp"
        tools:layout_constraintLeft_creator="1"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintTop_toTopOf="parent"
        android:layout_marginLeft="394dp" />

    <Button
        android:id="@+id/button2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:onClick="buttomClick"
        android:text="Button2"
        tools:layout_constraintTop_creator="1"
        android:layout_marginStart="16dp"
        android:layout_marginTop="37dp"
        app:layout_constraintTop_toBottomOf="@+id/button"
        tools:layout_constraintLeft_creator="1"
        app:layout_constraintLeft_toLeftOf="parent"
        android:layout_marginLeft="16dp" />

in the button on click property type the methode name topClick for example
the java code methode name must match

the buttons need you to write methodes or they will crash the apk :

in the code view :

Code:

package com.example.lenovo.myapplication;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Toast;

public class helloworld extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_helloworld);
        Toast.makeText(this, "Can you see me", Toast.LENGTH_SHORT).show();
        Log.i("info", "Done creating the app");
    }
    public void topClick(View v){  Toast.makeText(this, "Top button clicked",      Toast.LENGTH_SHORT).show();  Log.i("info","The user clicked the top button"); }
    public void buttomClick(View v){  Toast.makeText(this, "Bottom button clicked",    Toast.LENGTH_SHORT).show();  Log.i("info","The user clicked the bottom button"); }
}


stand with mouse on error (red code) area,
Alt + Enter keyboard combination to import the View class and remove the errors

you will see the messages when you run the apk and click the btns. :bounce:

descriptionandroid studio walkthroughs Empty2 using the buttom monitor tab

more_horiz

code :

Code:

// = comment
// TODO: edit buy bananas

in the logcat todo, the above reminder will appear
Terminal: You can use this to navigate your OS and do anything you can do from a console (DOS) window.
• Messages: As the name suggests, you will get system and error messages in this window.
privacy_tip Permissions in this forum:
You cannot reply to topics in this forum
power_settings_newLogin to reply