الهدف الرئيس من هذا الفيديو التعليمي هو التعرف على مفهوم 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
Have you ever found yourself wishing you could dive into the thrilling world of Westeros,…
In this digital age, preserving memories has become more accessible than ever. However, many of…
In the ever-evolving landscape of party games, where humor and creativity collide, the "Horrible Therapist"…
Football visors are transparent or tinted shields attached to the helmet's face mask. They're primarily…
Introduction to Beijing Beijing, the capital of China, is a city that beautifully intertwines the…
Introduction to Bangla Newspaper Industry The Bangla newspaper sector has witnessed an incredible transformation over…