Categories: ANDROID APP

Android Programming Lesson-2: JustJava



الهدف الرئيس من هذا الفيديو التعليمي هو التعرف على مفهوم variables & strategies واستخدامهم في تطبيق بواسطة android studio والبرمجة بلغة الجافا بشكل مبسط جداً. وأيضا وفي السياق استخدام بسيط لـ constraint format وتفعيل استخدام الأزرار buttons وكذلك system crash

الجزء التالي هو كود البرمجة بلغة الجافا والتي يفترض لصقها داخل الملف ActivityMain.java وذلك وفقا للفيديو التعليمي
/**
* IMPORTANT: Be sure you are utilizing the proper bundle title.
* This instance makes use of the bundle title:
* bundle com.instance.android.justjava
* If you happen to get an error when copying this code into Android studio, replace it to match the bundle title discovered
* within the mission’s AndroidManifest.xml file.
**/

import android.os.Bundle;
import android.help.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.TextView;

import java.textual content.NumberFormat;

/**
* This app shows an order kind to order espresso.
*/
public class MainActivity extends AppCompatActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
tremendous.onCreate(savedInstanceState);
setContentView(R.format.activity_main);
}

public void submitOrder(View view){

show(5);
displayPrice(amount*2);

}

}
/**
* This methodology known as when the order button is clicked.
*/
public void show(int quantity) {
TextView quantityTextView = (TextView) findViewById(R.id.quantity_text_view);
quantityTextView.setText(“” + quantity);
}

/**
* This methodology shows the given worth on the display screen.
*/
personal void displayPrice(int quantity) {
TextView priceTextView = (TextView) findViewById(R.id.price_text_view);
priceTextView.setText(NumberFormat.getCurrencyInstance().format(quantity));
}
}

source

linda

Recent Posts

Understanding USCIS Translation Requirements for Applications

When you're submitting documents to USCIS, any document that isn't in English must be accompanied…

3 days ago

Exploring the Benefits of Mposport Participation

Greetings, fellow writers and storytellers! Have you ever stumbled upon Mposport? If the name doesn’t…

3 days ago

Interactive Chat Games Inspired by Thrones

Have you ever found yourself wishing you could dive into the thrilling world of Westeros,…

2 weeks ago

Revive Your Memories: Free AI Photo Restoration

In this digital age, preserving memories has become more accessible than ever. However, many of…

2 weeks ago

Top Horrible Therapist Games to Try

In the ever-evolving landscape of party games, where humor and creativity collide, the "Horrible Therapist"…

2 weeks ago

How Visors Enhance Player Safety in Football

Football visors are transparent or tinted shields attached to the helmet's face mask. They're primarily…

4 weeks ago