Разработка моего первого приложения для Android. Работает нормально на эмуляторе, но на телефоне я получаю "Source not found error" ViewRoot.handleMessage(Message)line:1757
. Я получаю сообщение об ошибке, когда нажимаю кнопку № 4 в приложении и пытаюсь отобразить мои мультимедийные изображения на телефоне.
Код:
package com.example.famiily_connect_v1;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
public class family_connect extends Activity implements OnClickListener {
/** Called when the activity is first created. */
Button incrementButton, decrementButton, makecallButton,
media_cameraButton;
TextView numberdisplayTextView;
EditText inputEditText;
int A = 0;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
incrementButton = (Button) findViewById(R.id.Button01);
decrementButton = (Button) findViewById(R.id.Button02);
makecallButton = (Button) findViewById(R.id.Button03);
media_cameraButton = (Button) findViewById(R.id.Button04);
numberdisplayTextView = (TextView) findViewById(R.id.TextView01);
inputEditText = (EditText) findViewById(R.id.EditText01);
incrementButton.setOnClickListener(this);
decrementButton.setOnClickListener(this);
makecallButton.setOnClickListener(this);
media_cameraButton.setOnClickListener(this);
numberdisplayTextView.setOnClickListener(this);
inputEditText.setOnClickListener(this);
}
@Override
public void onClick(View arg0) {
switch (arg0.getId()) {
case R.id.Button01:
A++;
numberdisplayTextView.setText(String.valueOf(A));
break;
case R.id.Button02:
A--;
numberdisplayTextView.setText(String.valueOf(A));
break;
case R.id.Button03:
break;
case R.id.Button04:
Intent myIntent = new Intent();
myIntent.setAction(Intent.ACTION_VIEW);
myIntent.setData(android.provider.MediaStore.Images.Media.INTERNAL_CONTENT_URI);
startActivity(myIntent);
break;
default:
break;
}
}
}
XML
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="fill_parent"
android:layout_height="fill_parent" android:background="#00AAAA">
<TextView android:layout_width="fill_parent"
android:layout_height="wrap_content" android:text="@string/hello" />
<LinearLayout android:id="@+id/LinearLayout01"
android:layout_width="wrap_content" android:layout_height="wrap_content"></LinearLayout>
<Button android:id="@+id/Button01" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:text="increment"></Button>
<Button android:id="@+id/Button02" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:text="decrement"></Button>
<Button android:id="@+id/Button03" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:text="make call"></Button>
<Button android:id="@+id/Button04" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:text="media_camera"></Button>
<TextView android:id="@+id/TextView01" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:textSize="24sp"
android:text="0" android:textStyle="bold" android:textColor="#000000"></TextView>
<EditText android:id="@+id/EditText01" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:text="enter new button text"></EditText>
<RadioButton android:id="@+id/RadioButton01"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:text="camera"></RadioButton>
</LinearLayout>