顯示具有 Android程式 標籤的文章。 顯示所有文章
顯示具有 Android程式 標籤的文章。 顯示所有文章

2020年9月20日 星期日

[ 黯語APP ] 購物比價器 - 主攻超市與超商


名  稱:購物比價器

版  本:1.2

檔案大小:8.2 MB

語  言:繁體中文

介紹:
主攻超市與超商比價,網購比價太多了。

2020年4月13日 星期一

[ Android Studio ] 創建軟體給的 FullscreenActivity 介面之說明


一、 setSystemUiVisibility屬性用法如下:

1. SYSTEM_UI_FLAG_LOW_PROFILE:
View已請求系統UI進入低調的“低調”模式。

2. SYSTEM_UI_FLAG_HIDE_NAVIGATION:
已請求暫時隱藏系統導航。

2020年3月27日 星期五

[ Android Studio ] 使用 View 之 onDraw 在畫布 Canvas 繪畫出圓形等方法。

此教學是顯示在 ConstraintLayout 上面的方法,也可用到於顯示 SurfaceView 內。

SurfaceView 教學網址如下:
https://devildemon20100423.blogspot.com/2020/03/android-studio-surfaceview-canvas.html

一、程式顯示語法:

package com.example.canvas_0;
import androidx.appcompat.app.AppCompatActivity;
import androidx.constraintlayout.widget.ConstraintLayout;
import android.os.Bundle;
public class MainActivity extends AppCompatActivity {
@Overrideprotected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);

ConstraintLayout CL=findViewById(R.id.CL);

2020年2月7日 星期五

[ Android Studio ] MPAndroidChart套件之線圖圖表另存圖片又再 ImageView 顯示





修改檔案 AndroidManifest.xml 如下:
權限:
 <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
 <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />

2020年1月12日 星期日

[ Android Studio ] 訊息通知Notification的方法


出現通知所顯示的下拉清單裡的訊息方法如下:

一、版本問題:
API26以上就要設定NotificationChannel為通知頻道NotificationChannel(id,name,NotificationManager.IMPORTANCE_HIGH);

2019年12月12日 星期四

[ Android Studio ] 創建新增修改刪除XML文件檔

此教學不是Android的XML的資源檔,而是另外創建一個XML檔案。
把XML檔當成資料庫來使用,缺點只能存取少部分資料。

一、創建實體的XML檔語法如下:
  DocumentBuilderFactory builderFactory = DocumentBuilderFactory.newInstance();
try {
    //產生實體一個DocumentBuilder, XML文檔獲取DOM Document實例    DocumentBuilder builder =  builderFactory.newDocumentBuilder();
    //產生一個實體xml    Document newxml = builder.newDocument();
    //創建一個根標籤  Element text_url = newxml.createElement("text0");

2019年11月9日 星期六

[ Android Studio ] MPAndroidChart套件之線圖圖表教學


圖表樣式預設畫面如下:(最下面有教學影片)

一、Description描述:創建圖表顯示的信息
Description description =new Description();
description.setText("圖表");

2019年10月19日 星期六

[ Android Studio ] 簡易計步器使用感應元件Sensor


用法:

1. 取得感應服務使用權限
sm = (SensorManager) this.getSystemService(Context.SENSOR_SERVICE);

2. 取得手機感應狀態
sensor = sm.getDefaultSensor(Sensor.TYPE_ACCELEROMETER);

2019年9月28日 星期六

[ Android Studio ] Spinner 下拉式選單載入資料的方法

此教學為簡化陣列資料匯入下拉式選單的方法。

介面XML:
<Spinner    android:id="@+id/spinner"    android:layout_width="match_parent"    android:layout_height="wrap_content" />

2019年9月6日 星期五

[ Android Studio ] QR掃描與產生的方法 com.journeyapps與zxing

此語法為 Android SDK 19+以上才能使用,舊版本請於下面網址查詢。

一、在build.gradle的app加入
dependencies {
    .....
    implementation 'com.journeyapps:zxing-android-embedded:3.5.0'}


2019年8月30日 星期五

[ Android Studio ] 連線MySQL搜尋篩選查詢資料的方法

一、PHP修改index.php內容另一個方法如下:
影片俢改如下:
$inserSQL=isset($_POST["S1"])<>NULL?"select * from text1 where name='".$_POST["S1"]."'":"select * from text1";
mysql_select_db($database,$GD);
$Result=mysql_query($inserSQL,$GD) or die(mysql_error());

另一個方法:
$inserSQL=isset($_POST["S1"])<>NULL?" where name='".$_POST["S1"]."'":"";
$sql="select * from text1".$inserSQL;
mysql_select_db($database,$GD);
$Result=mysql_query($sql,$GD) or die(mysql_error());


二、用POST傳送空值給PHP所出現錯誤為org.json.JSONException: Value null of type org.json.JSONObject$1 cannot be converted to JSONArray 如何解?

答:

if(i!=null && !i.toString().equals("")) {
//語法

}

.equals("")不能為.equals(null)

教學影片:

2019年6月8日 星期六

[ Android Studio ] SQLite圖片入資料庫與ID編號重新排列


一、字串轉換成圖片的方法:

byte[] bitmapArray;
bitmapArray= Base64.decode(cursor.getString(3),Base64.DEFAULT);
bitmap= BitmapFactory.decodeByteArray(bitmapArray,0,bitmapArray.length);

二、圖片轉換成字串的方法:

2019年5月14日 星期二

[ Android Studio ] 用 org.apache.http.legacy 連線網路問題解答 (API版本相關)

import org.apache.http.*;

HttpClient、HttpPost、DefaultHttpClient、HttpResponse、HttpEntity
用這些元件來連線網路只能在API 22含以下使用


一、此為API 22以上使用需在build.gradle(Module:app) 加入 (紅色的字)

2019年4月28日 星期日

[ Android Studio ] SQLite之ListView點擊出現刪除對話框

最下面有影片教學。

相關元件有

FragmentTransaction 片段交易
Fragment 片段
DialogFragment 對話框片段



ListView點擊語法:

2019年3月29日 星期五

[ Android Studio ] JSONArray 顯示錯誤問題解決方法

出現的錯誤:

E/log_tag=: org.json.JSONException: Value java.lang.IllegalArgumentException of type java.lang.String cannot be converted to JSONArray

解決的方法:

2019年2月9日 星期六

[ Android Studio ] FrameLayout框架佈局 與 BottomNavigationView底部導航視圖的教學


語法教學如下:

BottomNavigationView 底部按鈕基本教學

加入
private FragmentManager fragmentManager;
private  FragmentTransaction transaction;

BottomNavigationView.OnNavigationItemSelectedListener以下加入

fragmentManager=getSupportFragmentManager();
transaction = fragmentManager.beginTransaction();

2018年12月14日 星期五

[繪圖] 配色神器

網站畫面設計、App畫面設計、小圖設計等都會用到配色。
在此整理了一些比較好用的配色網站免下載。


1. Stylifyme

抓取他人網站配色方式。


2018年12月8日 星期六

[ MIT App Inventor ] TinyDB簡易資料庫儲存方法與Spinner用法

TinyDB 元件為簡單可用來儲存資料的資料庫。
想寫簡單的APP加資料庫它是很好的選擇,跟SQLite相關為單機內資料庫。


可用以下方法: