Android App Starting Java Function

Android Devlopment Java Function

Posted by indranil on Jan. 5, 2021, 1:45 p.m.

Android App Java Function: (MainActivity.java)

 

package com.nodomain.myapplication;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.view.View;
import android.widget.EditText;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.Toast;


public class MainActivity extends AppCompatActivity {

public void btnClick(View view){
EditText dollarAmount = (EditText) findViewById(R.id.dollarAmount);
String dollars = dollarAmount.getText().toString();
Double doubleDollars = Double.parseDouble(dollars);
Double doubleInr = 75 * doubleDollars;
String myQuery = "=" + doubleInr.toString() + "$ ";
Toast.makeText(this, myQuery, Toast.LENGTH_SHORT).show();

}

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

noimg Visit Link: digitalocean.com