[リストへもどる]
一括表示
タイトル写真取得失敗
記事No6384
投稿日: 2021/03/09(Tue) 11:24
投稿者kasai
android_studio3の"追加画面に写真を表示"のところで実行しさいごの「写真」をタップしたところ、画面に表示されませんでした。どうしたらいいでしょうか?よろしくお願いいたします。

タイトルRe: 写真取得失敗
記事No6385
投稿日: 2021/03/09(Tue) 22:39
投稿者サーチマン佐藤
直前で作る hoelinput.xml画面のソースが間違っている気がしますが。

タイトルRe^2: 写真取得失敗
記事No6386
投稿日: 2021/03/10(Wed) 15:19
投稿者kasai
> 直前で作る hoelinput.xml画面のソースが間違っている気がしますが。
ソースを見なしたのですが、わかりません。
ソースを以下に示しますので、よろしくお願いいたします。
[<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >

<TextView
android:id="@+id/textView_no"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/no" />

<EditText android:background="#b0c4de"
android:id="@+id/input_no"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:inputType="number" />

<TextView
android:id="@+id/textView_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/name" />

<EditText android:background="#b0c4de"
android:id="@+id/input_name"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:inputType="text" />

<TextView
android:id="@+id/textView_address"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/address" />

<EditText android:background="#b0c4de"
android:id="@+id/input_address"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:inputType="text" />

<TextView
android:id="@+id/textView_tel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/tel" />

<EditText android:background="#b0c4de"
android:id="@+id/input_tel"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:inputType="phone" />

<TextView
android:id="@+id/textView_comment"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/comment" />

<EditText android:background="#b0c4de"
android:id="@+id/input_comment"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:inputType="text" />

<ImageView
android:id="@+id/input_photo"
android:layout_width="wrap_content"
android:layout_height="100dp"
/>

<Button style="?android:attr/borderlessButtonStyle"
android:id="@+id/button_photo"
android:text="@string/photo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:onClick="photo"
/>

<Button
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:onClick="hotelInput"
android:text="@string/input_exec" />

</LinearLayout>
]

タイトルRe^3: 写真取得失敗
記事No6387
投稿日: 2021/03/10(Wed) 18:41
投稿者サーチマン佐藤
お疲れさまです。xmlは大丈夫なようです。

あと怪しいのは、HotelDataEntry.javaに
imgView = (ImageView)findViewById(R.id.input_photo);
を入れてありますか?

タイトルRe^4: 写真取得失敗
記事No6388
投稿日: 2021/03/10(Wed) 20:35
投稿者kasai
入れてあります。
[ @Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.hotelinput);
imgView = (ImageView)findViewById(R.id.input_photo);

Intent intent = getIntent(); // 引数を受け取るインテント
mode = intent.getStringExtra("mode"); // 実行モード(insert or update)

if (mode.equals("update")) {
getData(); // データの取得

//取得したデータを画面に入れる
]

タイトルRe^5: 写真取得失敗
記事No6395
投稿日: 2021/03/13(Sat) 14:52
投稿者サーチマン佐藤
そのエラーの原因は、エミュレータが起動していないためです。
エミュレータを起動しましょう。

タイトルRe: 写真取得失敗
記事No6389
投稿日: 2021/03/10(Wed) 21:15
投稿者サーチマン佐藤
そうですか。
その辺が怪しかったのですが。

すみません、今、思い当たる所はなくて、
でも、他の皆さんは出来ていますので、
何か抜けがあるのだと思います。

ちなみに、何かエラーメッセージありますか?

なければ、ひとまず、テキスト通りに動く所まで戻って、
一度、見直してみてください。

私も、何か気がついたら、すぐにご連絡します。

タイトルRe^2: 写真取得失敗
記事No6390
投稿日: 2021/03/11(Thu) 12:53
投稿者kasai
やり直すとしたら、どこからやり直したらよいでしょうか?

タイトルRe^3: 写真取得失敗
記事No6392
投稿日: 2021/03/12(Fri) 17:05
投稿者サーチマン佐藤
今のプロジェクトをコンテンツごと削除して、
以下から、やり直しましょう。
https://searchman.info/lesson/android-studio3/1030.html

タイトルRe^4: 写真取得失敗
記事No6394
投稿日: 2021/03/13(Sat) 11:56
投稿者kasai
> 今のプロジェクトをコンテンツごと削除して、
> 以下から、やり直しましょう。
> https://searchman.info/lesson/android-studio3/1030.html
コマンドプロンプトで「chcp 65001」と打ち込み(メッセージ[Active code page: 65001]) 
["C:\android\sdk\platform-tools\adb" shell]をコピペすると、
メッセージ[* daemon not running; starting now at tcp:5037
* daemon started successfully
adb.exe: no devices/emulators found]
となり、コマンドが$となりませんでした。
このため、次に進めず、ファイルを削除ができません。
よろしくお願いいたします。

タイトルRe^4: 写真取得失敗
記事No6396
投稿日: 2021/03/14(Sun) 21:33
投稿者kasai
android-studio3/1030.htmlから、やり直して前と同じ結果でした。
ホテル一覧をタップし、プリンスホテルをタップすると、1回目は最初の画面に戻りました。2回目は「HotelData」が繰り返し停止していますというメッセージが出てきました。Buildにエラーはありませんでした。
よろしくお願いいたします。

タイトルRe^2: 写真取得失敗
記事No6391
投稿日: 2021/03/11(Thu) 13:46
投稿者kasai

> ちなみに、何かエラーメッセージありますか?
エラーメッセージの見方を教えてください。
(フィルターのかけ方とか)

タイトルRe^3: 写真取得失敗
記事No6393
投稿日: 2021/03/12(Fri) 17:06
投稿者サーチマン佐藤
Android Studio画面のBuild に出ていませんか。