intent用に画面を作成する

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    android:gravity="center"
    tools:context=".MyResult">

    <TextView
        android:text="〇〇さんの点数は"
        android:textSize="16sp"
        android:layout_marginBottom="24dp"
        android:id="@+id/nameLabel"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"/>

    <TextView
        android:text="90点でした"
        android:textSize="32sp"
        android:textStyle="bold"
        android:layout_marginBottom="24dp"
        android:id="@+id/scoreLabel"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"/>


</LinearLayout>

alertDialogを使ってみよう

AlertDialog.builderとして、setTitle,setMessage,setPoisitiveButtonを設定していきます。

if (myName.equals("")){
        AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(this);
        alertDialogBuilder
                .setTitle("Error!")
                .setMessage("Please enter your name!")
                .setPositiveButton("OK", null);
        AlertDialog alertDialog = alertDialogBuilder.create();
        alertDialog.show();
        } else {

        }

かっけーーーー!!!!!!!!!

setError, toast, alertDialogだったら、断トツでalertDialogがいいな。

toastを表示する

toastの場合、Toast.makeTextとしてますね。

 if (myName.equals("")){
            // エラー処理
            // myEditText.setError("Please enter your name!");
            Toast.makeText(
                    this,
                    "please enter your name!",
                    Toast.LENGTH_LONG
            ).show();
        } else{

        }

setErrorで、EditTextがnullの場合にerror表示する

onClickでgetScoreを実行します。
nullの場合、EditTextにsetErrorします。

public void getScore(View view){
        // edittextを取得
        EditText myEditText = (EditText) findViewById(R.id.myEditText);
        // edittextの中身を取得
        String myName = myEditText.getText().toString().trim();
        // 中身を観て条件分岐
        if (myName.equals("")){
            // エラー処理
            myEditText.setError("Please enter your name!");
        } else{

        }
    }

OK!わかってきた

MainActivity.javaでEditTextの取得

public void getScore(View view){
        // edittextを取得
        EditText myEditText = (EditText) findViewById(R.id.myEditText);
        // edittextの中身を取得
        String myName = myEditText.getText().toString().trim();
        // 中身を観て条件分岐
        if (myName.equals("")){
            // エラー処理
        } else{
            
        }
    }

androidのform

form は EditText

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="horizontal"
    tools:context=".MainActivity">

    <EditText
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:hint="your name ..."
        />

</LinearLayout>

onclick時の呼び出しメソッドをxmlに記載する

activity_sub.xmlからactivity_main.xmlに遷移する

buttonを設置し、SubActivityからも同じように遷移する

public class SubActivity extends AppCompatActivity implements View.OnClickListener{

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

        findViewById(R.id.button).setOnClickListener(this);
    }
    public void onClick(View view){
        Intent intent  = new Intent(this, MainActivity.class);
        startActivity(intent);
    }
}

activity_sub.xmlからも遷移できるようになりました。
画面遷移は大体OKですね。

androidで画面遷移をつくる

まず、activity_main.xml
linearlayouにbuttonを配置する

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    tools:context=".MainActivity">

    <Button
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Button"
        android:id="@+id/button"></Button>

</LinearLayout>

New -> Activity -> Empty を選択する

ActivityNameを決める。ここでは、SubActivity

すると、res->layoutにactivity_sum.xmlができ、java->jp->hogeにSubActivity.javaが出来ている。

activity_sub.xml

<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".SubActivity">


    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="サンプルの遷移先です"
        android:id="@+id/textView"
        />

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="サンプルの遷移先です"
        android:id="@+id/textView"
        />

</android.support.constraint.ConstraintLayout>

MainActivity.java

this, SubActivity.class
Intent classでは遷移元と遷移先を実装している。

package jp.hoge.listview;

import android.content.Context;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;

import java.util.ArrayList;

import jp.hoge.anew.SubActivity;

public class MainActivity extends AppCompatActivity
 implements View.OnClickListener{

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

        findViewById(R.id.button).setOnClickListener(this);
    }
    public void onClick(View view){
        Intent intent  = new Intent(this, SubActivity.class);
        startActivity(intent);
    }
}

buttonを押すと、activity_sub.xmlに遷移するようになりました。なるほど!

フィルムカメラを現像して、QRコードでスマホに転送する

EOS630で撮影した写真をPALETTE PLAZAさんでフィルムから現像して、QRコードでiosに転送しダウンロード

現像24枚で700円、スマホ転送サービス500円、現像の所要時間1時間

やっぱり現像はめんどくさい&スマホ転送サービスを使うと画質が落ちるらしい
->どう考えてもデジカメの方がいい
->iphoneのカメラで撮れば、現像なんて面倒なことしなくていい

といいつつ、またフィルムを買ってしまった。
ああああああああああああああああ、、、、、駄目だこりゃ。

で、思ったこと。
1.みんないいカメラを使っている。
2.カメラの撮り方も色々あるっぽい。(素人目では、どういう撮り方がいいのか良くわからない)
3.カメラも大事だが被写体も大事。
4.一眼レフカメラをやってる人は年齢層が高い。
5.あまりやりすぎても本末転倒(プログラミングに時間をかけるべき)だが、カメラもまあまあ面白い

で、一番知りたかったことだが、
6.いいカメラマンの見分け方 ->まだ全然わからないが、経験ある人・カメラに情熱がある人の方が知識が豊富で勉強になりそうだ
これは、今後productをつくっていく上で大事かも。。

ic_launcher_roundを使う

int[] icons = {
                R.mipmap.ic_launcher_round,
                R.mipmap.ic_launcher,
                R.mipmap.ic_launcher,
        };

丸いアイコンになりました。
R.mipmapは、resのmipmapの中、という意味でしょうかね。

では、res->drawableにlogo.pngを置いて、R.drawable.logoと書きます。

int[] icons = {
                R.drawable.logo,
                R.mipmap.ic_launcher,
                R.mipmap.ic_launcher,
        };

あら、サイズがおかしなことになってますが、R.drawable.logoで表示はされているようです。
logo.pngがphotoshop書き起こしのサイズですね。。