-1

これで約1時間立ち往生しています-簡単な修正かもしれませんが、私はそれを理解できません.

開始画面にボタンがあり、クリックすると別のアクティビティに移動します。

これはxmlからのものです:

<ImageButton
        android:id="@+id/btn_text_scan"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:contentDescription="@string/scan_button_description"
        android:layout_alignParentBottom="true"
        android:layout_centerHorizontal="true"
        android:background="@null"
        android:gravity="center"
        android:scaleType="centerInside"
        android:onClick="textExtract"
        android:src="@drawable/ic_btn_text" />

これはマニフェストからのものです:

    <activity
        android:configChanges="orientation|keyboardHidden"
        android:launchMode="singleTop"
        android:name=".OCRActivity">
    </activity>

そして、移動したいクラスから、このコードを使用して他のアクティビティに移動します。(ただし、このコードを削除しても、まだこの問題が発生します-おそらくこれではないでしょう)

public void textExtract(View view) 
{
    Intent intent = new Intent(ScannerActivity.this, OCRActivity.class);
    startActivity(intent);
}

アクティビティのコードを提供できますが、これは必要ないと思います

どんな助けでも大歓迎です!ダン

EDIT LogCat エラー http://i.imgur.com/zK43neM.png

4

3 に答える 3

0

super.onCreate(bundle);メソッドの最初の行として呼び出す必要がありますonCreate(Bundle bundle)bundle別の名前が付けられている可能性がありますが、このメソッドに渡されるものは何でもです。

の他のライフサイクル メソッドについても同じことが言えますActivity。たとえば、onPauseメソッドの最初の行は への呼び出しである必要がありますsuper.onPause()

于 2013-11-08T15:45:00.277 に答える
0

android:background="@null"XML でその行を削除してみて、それが機能するかどうかを確認してください。

于 2013-11-08T15:54:11.987 に答える
0

これを試して:

Intent intent = new Intent(getApplicationContext(), OCRActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
getApplicationContext().startActivity(intent);
于 2013-11-08T15:47:56.160 に答える