安卓編程計算
1. 難道就沒有好用的安卓計算器軟體了嗎
好用的安卓計算器有許多,如:
1.科學計算器
科學計算器是一款體積小巧、功能十分簡潔的科學計算器,它支持多行輸入,用戶可輸入完整計算公式進行運算。它可以用於科學計算,包括不同進制數的轉換。它的界面設計十分人性化,採用與物理科學計算器幾乎相同的界面,幫助用戶快速進入運算。
2. 可編程科學計算器安卓版手機版編程用什麼語言編程
Android的話,一般是java和C++咯
3. 在安卓編程裡面,用線程計算1+到100
package cn.test;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
public class TestUtil {
public static void main(String[] args) {
K k = new K();
ExecutorService pool = Executors.newCachedThreadPool();
for(int i=1;i<101;i++){
pool.execute(new AddThread(k,i));
}
pool.shutdown();
// while(!pool.isTerminated()){
// try {
// Thread.sleep(1000);
// } catch (InterruptedException e) {
// e.printStackTrace();
// }
// }
System.out.println("結果為:"+k.getTotal());
}
}
class AddThread implements Runnable{
public AddThread(K k, int add) {
this.k = k;
this.add = add;
}
private K k;
private int add;
@Override
public void run() {
k.add(add);
}
}
class K{
private int total=0;
public int getTotal() {
return total;
}
public void setTotal(int total) {
this.total = total;
}
public synchronized void add(int k){
this.total=total+k;
}
}
4. 開發一個簡易的計算器APP程序 Android源代碼
下面是效果展示:
復制代碼代碼如下:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="s/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<LinearLayout android:layout_width="fill_parent"
android:layout_height="wrap_content">
<TextView
android:id="@+id/tvResult"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:height="50dp"
android:text="@string/tvResult"
/>
</LinearLayout>
<LinearLayout android:layout_width="fill_parent"
android:layout_height="wrap_content">
<Button
android:id="@+id/btnBackspace"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:width="150dp"
android:layout_marginLeft="10dp"
android:text="@string/btnbackspace"/>
<Button
android:id="@+id/btnCE"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:width="150dp"
android:text="@string/btnCE"/>
</LinearLayout>
<LinearLayout android:layout_width="fill_parent"
android:layout_height="wrap_content">
<Button
android:id="@+id/btn7"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:width="75dp"
android:text="@string/btn7"/>
<Button
android:id="@+id/btn8"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:width="75dp"
android:text="@string/btn8"/>
<Button
android:id="@+id/btn9"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:width="75dp"
android:text="@string/btn9"/>
<Button
android:id="@+id/btnDiv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:width="75dp"
android:text="@string/btnDiv"/>
</LinearLayout>
<LinearLayout android:layout_width="fill_parent"
android:layout_height="wrap_content">
<Button
android:id="@+id/btn4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:width="75dp"
android:text="@string/btn4"/>
<Button
android:id="@+id/btn5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:width="75dp"
android:text="@string/btn5"/>
<Button
android:id="@+id/btn6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:width="75dp"
android:text="@string/btn6"/>
<Button
android:id="@+id/btnMul"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:width="75dp"
android:text="@string/btnMul"/>
</LinearLayout>
<LinearLayout android:layout_width="fill_parent"
android:layout_height="wrap_content">
<Button
android:id="@+id/btn1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:width="75dp"
android:text="@string/btn1"/>
<Button
android:id="@+id/btn2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:width="75dp"
android:text="@string/btn2"/>
<Button
android:id="@+id/btn3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:width="75dp"
android:text="@string/btn3"/>
<Button
android:id="@+id/btnAdd"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:width="75dp"
android:text="@string/btnAdd"/>
</LinearLayout>
<LinearLayout android:layout_width="fill_parent"
android:layout_height="wrap_content">
<Button
android:id="@+id/btn0"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:width="75dp"
android:text="@string/btn0"/>
<Button
android:id="@+id/btnC"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:width="75dp"
android:text="@string/btnC"/>
<Button
android:id="@+id/btnEqu"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:width="75dp"
android:text="@string/btnEqu"/>
<Button
android:id="@+id/btnSub"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:width="75dp"
android:text="@string/btnSub"/>
</LinearLayout>
</LinearLayout>
復制代碼代碼如下:
package com.example.week2;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.TextView;
import android.app.Activity;
public class MainActivity extends Activity implements OnClickListener{
//聲明一些控制項
Button btn0=null;
Button btn1=null;
Button btn2=null;
Button btn3=null;
Button btn4=null;
Button btn5=null;
Button btn6=null;
Button btn7=null;
Button btn8=null;
Button btn9=null;
Button btnBackspace=null;
Button btnCE=null;
Button btnC=null;
Button btnAdd=null;
Button btnSub=null;
Button btnMul=null;
Button btnDiv=null;
Button btnEqu=null;
TextView tvResult=null;
//聲明兩個參數。接收tvResult前後的值
double num1=0,num2=0;
double Result=0;//計算結果
int op=0;//判斷操作數,
boolean isClickEqu=false;//判斷是否按了「=」按鈕
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
//從布局文件中獲取控制項,
btn0=(Button)findViewById(R.id.btn0);
btn1=(Button)findViewById(R.id.btn1);
btn2=(Button)findViewById(R.id.btn2);
btn3=(Button)findViewById(R.id.btn3);
btn4=(Button)findViewById(R.id.btn4);
btn5=(Button)findViewById(R.id.btn5);
btn6=(Button)findViewById(R.id.btn6);
btn7=(Button)findViewById(R.id.btn7);
btn8=(Button)findViewById(R.id.btn8);
btn9=(Button)findViewById(R.id.btn9);
btnBackspace=(Button)findViewById(R.id.btnBackspace);
btnCE=(Button)findViewById(R.id.btnCE);
btnC=(Button)findViewById(R.id.btnC);
btnEqu=(Button)findViewById(R.id.btnEqu);
btnAdd=(Button)findViewById(R.id.btnAdd);
btnSub=(Button)findViewById(R.id.btnSub);
btnMul=(Button)findViewById(R.id.btnMul);
btnDiv=(Button)findViewById(R.id.btnDiv);
tvResult=(TextView)findViewById(R.id.tvResult);
//添加監聽
btnBackspace.setOnClickListener(this);
btnCE.setOnClickListener(this);
btn0.setOnClickListener(this);
btn1.setOnClickListener(this);
btn2.setOnClickListener(this);
btn3.setOnClickListener(this);
btn4.setOnClickListener(this);
btn5.setOnClickListener(this);
btn6.setOnClickListener(this);
btn7.setOnClickListener(this);
btn8.setOnClickListener(this);
btn9.setOnClickListener(this);
btnAdd.setOnClickListener(this);
btnSub.setOnClickListener(this);
btnMul.setOnClickListener(this);
btnDiv.setOnClickListener(this);
btnEqu.setOnClickListener(this);
}
@Override
public void onClick(View v) {
switch (v.getId()) {
//btnBackspace和CE--------------------
case R.id.btnBackspace:
String myStr=tvResult.getText().toString();
try {
tvResult.setText(myStr.substring(0, myStr.length()-1));
} catch (Exception e) {
tvResult.setText("");
}
break;
case R.id.btnCE:
tvResult.setText(null);
break;
//btn0--9---------------------------
case R.id.btn0:
if(isClickEqu)
{
tvResult.setText(null);
isClickEqu=false;
}
String myString=tvResult.getText().toString();
myString+="0";
tvResult.setText(myString);
break;
case R.id.btn1:
if(isClickEqu)
{
tvResult.setText(null);
isClickEqu=false;
}
String myString1=tvResult.getText().toString();
myString1+="1";
tvResult.setText(myString1);
break;
case R.id.btn2:
if(isClickEqu)
{
tvResult.setText(null);
isClickEqu=false;
}
String myString2=tvResult.getText().toString();
myString2+="2";
tvResult.setText(myString2);
break;
case R.id.btn3:
if(isClickEqu)
{
tvResult.setText(null);
isClickEqu=false;
}
String myString3=tvResult.getText().toString();
myString3+="3";
tvResult.setText(myString3);
break;
cas
5. 開發一個安卓計算器小程序需要哪些內容
頁面中Button使用的是線性布局,最外邊一個是父布局,第一行C,DEL,/,*為第一個子布局,第二行7,8,9,-為第二個子布局,第三行4,5,6,+為第三個子布局,第四五行為第四個子布局,第四個子布局中還有兩個相當於是孫布局的級別,1,2,3為第一個孫布局,0和.為第二個孫布局,=在兩個孫布局之外第四個子布局以內。因為計算器的水平豎直排列十分鮮明,所以可以用線性布局,當然也可以用表格布局來進行排布。
6. 騰訊創想編程怎樣計算圖形面積或者用QPython 3 (安卓系統)
r = 3.5
h = 4.5
pi = 3.14
s = 1/3*pi*r**2*h
print(s)
7. 安卓怎樣實現計算器累加
輸入該計算公式完成以後按下計算器上的M加號鍵,此時可以看到顯示器上的計算結果。然後再在該計算器上界面中輸入公式240*2。如果沒有其他再次需要計算的公式時,在計算器的鍵盤上按下MR鍵,就可以看到該計算公式的累加結果了。
8. 有沒有手機計算器軟體,能算log,根號,次方的
有很多的,有些還有編程功能在裡面的。如在手機上用易歷知食軟體里的可編程計算器功能,就可以實現你的這個計算要求。例如要計算如下的表達式的的值:
整個表達式一次輸入,一次得結果。
9. 如何正確地在android上計算webrtc
檢查你的本地是否有nodejs,可以用命令行node -v查詢版本號,如果報錯就是沒有安裝,正確應該是如下圖顯示版本。將ProjectRTC 項目clone到本地,因為我公司網路不好,clone了三四次都失敗了,後來我是直接下載的壓縮文件。【點擊免費試用,0成本啟動】
WebRTC實現了基於網頁的視頻會議,標準是WHATWG 協議,目的是通過瀏覽器提供簡單的javascript就可以達到實時通訊(Real-Time Communications (RTC))能力。
WebRTC(Web Real-Time Communication)項目的最終目的主要是讓Web開發者能夠基於瀏覽器(ChromeFireFox...)輕易快捷開發出豐富的實時多媒體應用,而無需下載安裝任何插件,Web開發者也無需關注多媒體的數字信號處理過程,只需編寫簡單的Javascript程序即可實現,W3C等組織正在制定Javascript 標准API,目前是WebRTC1.0版本,Draft狀態;另外WebRTC還希望能夠建立一個多互聯網瀏覽器間健壯的實時通信的平台,形成開發者與瀏覽器廠商良好的生態環境。
想要了解更多關於這方面的相關信息,推薦咨詢ZEGO即構科技。ZEGO即構科技自成立伊始,就專注自研音視頻引擎,在音頻前處理、網路自適應和跨平台兼容性等方面,達到國際一流水平,同時充分利用基礎雲服務商的能力,構建了MSDN海量有序自學習數據網路,服務覆蓋全球,涵蓋上百個音視頻互動業務場景,單日時長突破30億分鍾。
10. 用android怎麼做計算BMI值得程序
應用的操作和原理
目標Android應用的操作過程是這樣的:選擇你的性別,然後輸入你的身高,點查看計算結果的按鈕就在Toast中顯示你的標准體重。力求操作簡單,結果顯示清楚。
標准體重的計算公式:
男性:(身高cm-80)×70%=標准體重
女性:(身高cm-70)×60%=標准體重
應用的源碼
BMIActivity.java:
packagecom.ling.bmi;
importjava.text.DecimalFormat;
importjava.text.NumberFormat;
importandroid.app.Activity;
importandroid.os.Bundle;
importandroid.view.View;
importandroid.view.View.OnClickListener;
importandroid.widget.Button;
importandroid.widget.EditText;
importandroid.widget.RadioButton;
importandroid.widget.Toast;
/*
*@authorling*該程序的功能是用戶選擇自己的性別和輸入自己的身高,然後點擊按鈕,就能在Toast顯示出自己的標准體重
*/
{
/**.*/
privateButtoncountButton;
privateEditTextheighText;
privateRadioButtonmaleBtn,femaleBtn;
Stringsex="";
doubleheight;
@Override
publicvoidonCreate(BundlesavedInstanceState){
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
//調用創建視圖的函數
creadView();
//調用性別選擇的函數
sexChoose();
//調用Button注冊監聽器的函數
setListener();
}
//響應Button事件的函數
privatevoidsetListener(){
countButton.setOnClickListener(countListner);
}
=newOnClickListener(){
@Override
publicvoidonClick(Viewv){
//TODOAuto-generatedmethodstub
Toast.makeText(BMIActivity.this,"你是一位"+sexChoose()+" "
+"你的身高為"+Double.parseDouble(heighText.getText().toString())+"cm"
+" 你的標准體重為"+getWeight(sexChoose(),height)+"kg",Toast.LENGTH_LONG)
.show();
}
};
//性別選擇的函數
privateStringsexChoose(){
if(maleBtn.isChecked()){
sex="男性";
}
elseif(femaleBtn.isChecked()){
sex="女性";
}
returnsex;
}
//創建視圖的函數
publicvoidcreadView(){
//txt=(TextView)findViewById(R.id.txt);
countButton=(Button)findViewById(R.id.btn);
heighText=(EditText)findViewById(R.id.etx);
maleBtn=(RadioButton)findViewById(R.id.male);
femaleBtn=(RadioButton)findViewById(R.id.female);
//txt.setBackgroundResource(R.drawable.bg);
}
//標准體重格式化輸出的函數
privateStringformat(doublenum){
NumberFormatformatter=newDecimalFormat("0.00");
Stringstr=formatter.format(num);
returnstr;
}
//得到標准體重的函數
privateStringgetWeight(Stringsex,doubleheight){
height=Double.parseDouble(heighText.getText().toString());
Stringweight="";
if(sex.equals("男性")){
weight=format((height-80)*0.7);
}
else{
weight=format((height-70)*0.6);
}
returnweight;
}
}