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

The Ultimate Guide to YouTube to MP4 Converters

A YouTube to MP4 conversion software is a software or on-the-web tool designed to download…

2 days ago

Unox Equipment: A Chef’s Companion

Cooking is an art, and each artist needs the right equipment to bring their masterpiece…

2 days ago

Comparing Electric Scooters: Features and Performance

Hey there, scooter enthusiast! Whether you're a seasoned rider or just thinking about zipping around…

2 days ago

Discovering Affordable Massage Services throughout Busan

Hey there, massage fans! If you're in Busan and also searching for a way to…

3 days ago

Guide to Aroma Massage Services in Busan

Hey there! If you're planning a trip to Busan, or if you're already here and…

3 days ago

Is Instant Famous Worth It? A Detailed Review of Their Follower Services

Are you looking for ways to get more followers on your social media accounts to…

3 days ago