Barcode Scanner ZXing integrieren

DerSchokoBär

Aktives Mitglied
Hallo zusammen,

ich bin dabei den Barcode-Scanner in eine App zu integrieren ohne ZXing als einzelne sprich parallel installierte App laufen zu haben.

Ich habe mich dabei an diesen beiden Tutorials orentiert:

Allerdings funktioniert die App nach beiden Anleitungen nicht.

Tutorial 1:
Integrate zxing barcode scanner into your Android app natively using Eclipse Damian Flannery's Blog


Java:
package de.novatec.novathek;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;

public class Barcode extends Activity {

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.barcode);
	}
	
	public void onClick(final View view) {
    	switch (view.getId()) {
    	case R.id.btn_barcode_scannen:
    		System.out.println("onClick 1");
    		Intent intent = new Intent("com.google.zxing.client.android.SCAN");
    		intent.putExtra("SCAN_MODE", "QR_CODE_MODE");
    		startActivityForResult(intent, 0);
    		System.out.println("onClick 2");
    		break;
    	}
	}
	
	public void onActivityResult(int requestCode, int resultCode, Intent intent) {
		System.out.println("onActivityResult");
		   if (requestCode == 0) {
		      if (resultCode == RESULT_OK) {
		    	 System.out.println("onActivityResult - RESULT_OK");
		         String contents = intent.getStringExtra("SCAN_RESULT");
		         String format = intent.getStringExtra("SCAN_RESULT_FORMAT");
		         // Handle successful scan
		      } else if (resultCode == RESULT_CANCELED) {
		         // Handle cancel
		    	  System.out.println("onActivityResult _ RESULT_CANCELD");
		      }
		   }
		}
}

barcode.xml

[XML]<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:eek:rientation="vertical" >

<Button
android:id="@+id/btn_barcode_scannen"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/btn_barcode_scannen"
android:eek:nClick="onClick" />

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

<EditText
android:id="@+id/editText1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10" >

<requestFocus />
</EditText>

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

<EditText
android:id="@+id/editText2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10" />

</LinearLayout>[/XML]

Es wird ein Intent ausgelöst. also kann ich wählen, mit welcher App ich den Barcode scannen will. Wähle ich "Barcode Scanner", friert die App ein und folgender Fehler taucht auf:
Code:
01-23 16:58:26.530: W/dalvikvm(12470): Exception Ljava/lang/NoClassDefFoundError; thrown while initializing Lcom/google/zxing/client/android/CaptureActivity;
01-23 16:58:26.530: W/dalvikvm(12470): Class init failed in newInstance call (Lcom/google/zxing/client/android/CaptureActivity;)
01-23 16:58:26.530: D/AndroidRuntime(12470): Shutting down VM
01-23 16:58:26.530: W/dalvikvm(12470): threadid=1: thread exiting with uncaught exception (group=0x41e9f2a0)
01-23 16:58:26.535: E/AndroidRuntime(12470): FATAL EXCEPTION: main
01-23 16:58:26.535: E/AndroidRuntime(12470): java.lang.ExceptionInInitializerError
01-23 16:58:26.535: E/AndroidRuntime(12470): 	at java.lang.Class.newInstanceImpl(Native Method)
01-23 16:58:26.535: E/AndroidRuntime(12470): 	at java.lang.Class.newInstance(Class.java:1319)
01-23 16:58:26.535: E/AndroidRuntime(12470): 	at android.app.Instrumentation.newActivity(Instrumentation.java:1057)
01-23 16:58:26.535: E/AndroidRuntime(12470): 	at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2015)
01-23 16:58:26.535: E/AndroidRuntime(12470): 	at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2125)
01-23 16:58:26.535: E/AndroidRuntime(12470): 	at android.app.ActivityThread.access$600(ActivityThread.java:140)
01-23 16:58:26.535: E/AndroidRuntime(12470): 	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1227)
01-23 16:58:26.535: E/AndroidRuntime(12470): 	at android.os.Handler.dispatchMessage(Handler.java:99)
01-23 16:58:26.535: E/AndroidRuntime(12470): 	at android.os.Looper.loop(Looper.java:137)
01-23 16:58:26.535: E/AndroidRuntime(12470): 	at android.app.ActivityThread.main(ActivityThread.java:4898)
01-23 16:58:26.535: E/AndroidRuntime(12470): 	at java.lang.reflect.Method.invokeNative(Native Method)
01-23 16:58:26.535: E/AndroidRuntime(12470): 	at java.lang.reflect.Method.invoke(Method.java:511)
01-23 16:58:26.535: E/AndroidRuntime(12470): 	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1006)
01-23 16:58:26.535: E/AndroidRuntime(12470): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:773)
01-23 16:58:26.535: E/AndroidRuntime(12470): 	at dalvik.system.NativeStart.main(Native Method)
01-23 16:58:26.535: E/AndroidRuntime(12470): Caused by: java.lang.NoClassDefFoundError: com.google.zxing.ResultMetadataType
01-23 16:58:26.535: E/AndroidRuntime(12470): 	at com.google.zxing.client.android.CaptureActivity.<clinit>(CaptureActivity.java:101)
01-23 16:58:26.535: E/AndroidRuntime(12470): 	... 15 more


Tutorial 2:
ZXing QR Reader Direct Integration | AndroidAZ

ScannerActivity:
Java:
package com.androidaz.scanner;

import android.graphics.Bitmap;
import android.os.Bundle;
import android.widget.Toast;

import com.google.zxing.Result;
import com.google.zxing.client.android.CaptureActivity;

public class ScannerActivity extends CaptureActivity 
{
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
    }
    
    @Override 
    public void handleDecode(Result rawResult, Bitmap barcode) 
    {
    	Toast.makeText(this.getApplicationContext(), "Scanned code " + rawResult.getText(), Toast.LENGTH_LONG);
    }
}


[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:eek:rientation="vertical" >

<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/hello" />

<FrameLayout
android:layout_width="200dip"
android:layout_height="200dip"
android:layout_gravity="center_horizontal">
<include layout="@layout/capture"/>
</FrameLayout>

</LinearLayout>[/XML]

Fehler der bei der xml angezeigt wird:
Code:
The following classes could not be instantiated:
- com.google.zxing.client.android.ViewfinderView (Open Class, Show Error Log)
See the Error Log (Window > Show View) for more details.


android.content.res.Resources$NotFoundException: Could not resolve resource value: 0x7F07000A.
    at android.content.res.BridgeResources.throwException(BridgeResources.java:693)
    at android.content.res.BridgeResources.getColor(BridgeResources.java:185)
    at com.google.zxing.client.android.ViewfinderView.<init>(ViewfinderView.java:66)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(    at sun.reflect.NativeConstructorAccessorImpl.newInstance(    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(    at java.lang.reflect.Constructor.newInstance(    at com.android.ide.eclipse.adt.internal.editors.layout.ProjectCallback.instantiateClass(ProjectCallback.java:413)
    at com.android.ide.eclipse.adt.internal.editors.layout.ProjectCallback.loadView(ProjectCallback.java:170)
    at android.view.BridgeInflater.loadCustomView(BridgeInflater.java:207)
    at android.view.BridgeInflater.createViewFromTag(BridgeInflater.java:135)
    at android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:746)
    at android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:64)
    at android.view.LayoutInflater.rInflate(LayoutInflater.java:718)
    at android.view.LayoutInflater_Delegate.parseInclude(LayoutInflater_Delegate.java:154)
    at android.view.LayoutInflater.parseInclude(LayoutInflater.java:773)
    at android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:736)
    at android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:64)
    at android.view.LayoutInflater.rInflate(LayoutInflater.java:718)
    at android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:749)
    at android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:64)
    at android.view.LayoutInflater.rInflate(LayoutInflater.java:718)
    at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
    at android.view.LayoutInflater.inflate(LayoutInflater.java:372)

Wenn ich auf den Hyperlink klicke "(ViewfinderView.java:66)", werde ich auf diese Klasse gelenkt (Diese gehört allerdings zu dem ZXing, ein anderes Projekt, das ich nur importiert habe):
Java:
/*
 * Copyright (C) 2008 ZXing authors
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      [url]http://www.apache.org/licenses/LICENSE-2.0[/url]
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.google.zxing.client.android;

import com.google.zxing.ResultPoint;
import com.google.zxing.client.android.camera.CameraManager;

import android.content.Context;
import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.Rect;
import android.util.AttributeSet;
import android.view.View;

import java.util.ArrayList;
import java.util.List;

/**
 * This view is overlaid on top of the camera preview. It adds the viewfinder rectangle and partial
 * transparency outside it, as well as the laser scanner animation and result points.
 *
 * @author [email]dswitkin@google.com[/email] (Daniel Switkin)
 */
public final class ViewfinderView extends View {

  private static final int[] SCANNER_ALPHA = {0, 64, 128, 192, 255, 192, 128, 64};
  private static final long ANIMATION_DELAY = 80L;
  private static final int CURRENT_POINT_OPACITY = 0xA0;
  private static final int MAX_RESULT_POINTS = 20;
  private static final int POINT_SIZE = 6;

  private CameraManager cameraManager;
  private final Paint paint;
  private Bitmap resultBitmap;
  private final int maskColor;
  private final int resultColor;
  private final int laserColor;
  private final int resultPointColor;
  private int scannerAlpha;
  private List<ResultPoint> possibleResultPoints;
  private List<ResultPoint> lastPossibleResultPoints;

  // This constructor is used when the class is built from an XML resource.
  public ViewfinderView(Context context, AttributeSet attrs) {
    super(context, attrs);

    // Initialize these once for performance rather than calling them every time in onDraw().
    paint = new Paint(Paint.ANTI_ALIAS_FLAG);
    Resources resources = getResources();
    maskColor = resources.getColor(R.color.viewfinder_mask); // Zeile 66
    resultColor = resources.getColor(R.color.result_view);
    laserColor = resources.getColor(R.color.viewfinder_laser);
    resultPointColor = resources.getColor(R.color.possible_result_points);
    scannerAlpha = 0;
    possibleResultPoints = new ArrayList<ResultPoint>(5);
    lastPossibleResultPoints = null;
  }

  public void setCameraManager(CameraManager cameraManager) {
    this.cameraManager = cameraManager;
  }

  @Override
  public void onDraw(Canvas canvas) {
    if (cameraManager == null) {
      return; // not ready yet, early draw before done configuring
    }
    Rect frame = cameraManager.getFramingRect();
    if (frame == null) {
      return;
    }
    int width = canvas.getWidth();
    int height = canvas.getHeight();

    // Draw the exterior (i.e. outside the framing rect) darkened
    paint.setColor(resultBitmap != null ? resultColor : maskColor);
    canvas.drawRect(0, 0, width, frame.top, paint);
    canvas.drawRect(0, frame.top, frame.left, frame.bottom + 1, paint);
    canvas.drawRect(frame.right + 1, frame.top, width, frame.bottom + 1, paint);
    canvas.drawRect(0, frame.bottom + 1, width, height, paint);

    if (resultBitmap != null) {
      // Draw the opaque result bitmap over the scanning rectangle
      paint.setAlpha(CURRENT_POINT_OPACITY);
      canvas.drawBitmap(resultBitmap, null, frame, paint);
    } else {

      // Draw a red "laser scanner" line through the middle to show decoding is active
      paint.setColor(laserColor);
      paint.setAlpha(SCANNER_ALPHA[scannerAlpha]);
      scannerAlpha = (scannerAlpha + 1) % SCANNER_ALPHA.length;
      int middle = frame.height() / 2 + frame.top;
      canvas.drawRect(frame.left + 2, middle - 1, frame.right - 1, middle + 2, paint);
      
      Rect previewFrame = cameraManager.getFramingRectInPreview();
      float scaleX = frame.width() / (float) previewFrame.width();
      float scaleY = frame.height() / (float) previewFrame.height();

      List<ResultPoint> currentPossible = possibleResultPoints;
      List<ResultPoint> currentLast = lastPossibleResultPoints;
      int frameLeft = frame.left;
      int frameTop = frame.top;
      if (currentPossible.isEmpty()) {
        lastPossibleResultPoints = null;
      } else {
        possibleResultPoints = new ArrayList<ResultPoint>(5);
        lastPossibleResultPoints = currentPossible;
        paint.setAlpha(CURRENT_POINT_OPACITY);
        paint.setColor(resultPointColor);
        synchronized (currentPossible) {
          for (ResultPoint point : currentPossible) {
            canvas.drawCircle(frameLeft + (int) (point.getX() * scaleX),
                              frameTop + (int) (point.getY() * scaleY),
                              POINT_SIZE, paint);
          }
        }
      }
      if (currentLast != null) {
        paint.setAlpha(CURRENT_POINT_OPACITY / 2);
        paint.setColor(resultPointColor);
        synchronized (currentLast) {
          float radius = POINT_SIZE / 2.0f;
          for (ResultPoint point : currentLast) {
            canvas.drawCircle(frameLeft + (int) (point.getX() * scaleX),
                              frameTop + (int) (point.getY() * scaleY),
                              radius, paint);
          }
        }
      }

      // Request another update at the animation interval, but only repaint the laser line,
      // not the entire viewfinder mask.
      postInvalidateDelayed(ANIMATION_DELAY,
                            frame.left - POINT_SIZE,
                            frame.top - POINT_SIZE,
                            frame.right + POINT_SIZE,
                            frame.bottom + POINT_SIZE);
    }
  }

  public void drawViewfinder() {
    Bitmap resultBitmap = this.resultBitmap;
    this.resultBitmap = null;
    if (resultBitmap != null) {
      resultBitmap.recycle();
    }
    invalidate();
  }

  /**
   * Draw a bitmap with the result points highlighted instead of the live scanning display.
   *
   * @param barcode An image of the decoded barcode.
   */
  public void drawResultBitmap(Bitmap barcode) {
    resultBitmap = barcode;
    invalidate();
  }

  public void addPossibleResultPoint(ResultPoint point) {
    List<ResultPoint> points = possibleResultPoints;
    synchronized (points) {
      points.add(point);
      int size = points.size();
      if (size > MAX_RESULT_POINTS) {
        // trim it
        points.subList(0, size - MAX_RESULT_POINTS / 2).clear();
      }
    }
  }
}

Folgende Fehlermeldung tritt auf:
Code:
01-23 17:09:34.505: W/dalvikvm(24175): VFY: unable to find class referenced in signature (Lcom/google/zxing/PlanarYUVLuminanceSource;)
01-23 17:09:34.510: W/dalvikvm(24175): VFY: Ljava/lang/Object; is not instance of Lcom/google/zxing/LuminanceSource;
01-23 17:09:34.510: W/dalvikvm(24175): VFY: bad arg 1 (into Lcom/google/zxing/LuminanceSource;)
01-23 17:09:34.510: W/dalvikvm(24175): VFY:  rejecting call to Lcom/google/zxing/common/HybridBinarizer;.<init> (Lcom/google/zxing/LuminanceSource;)V
01-23 17:09:34.510: W/dalvikvm(24175): VFY:  rejecting opcode 0x70 at 0x001d
01-23 17:09:34.510: W/dalvikvm(24175): VFY:  rejected Lcom/google/zxing/client/android/DecodeHandler;.decode ([BII)V
01-23 17:09:34.510: W/dalvikvm(24175): Verifier rejected class Lcom/google/zxing/client/android/DecodeHandler;
01-23 17:09:34.510: W/dalvikvm(24175): threadid=14: thread exiting with uncaught exception (group=0x41e9f2a0)
01-23 17:09:34.550: D/dalvikvm(24175): GC_CONCURRENT freed 202K, 6% free 12728K/13511K, paused 44ms+37ms, total 103ms
01-23 17:09:34.560: E/AndroidRuntime(24175): FATAL EXCEPTION: Thread-3946
01-23 17:09:34.560: E/AndroidRuntime(24175): java.lang.VerifyError: com/google/zxing/client/android/DecodeHandler
01-23 17:09:34.560: E/AndroidRuntime(24175): 	at com.google.zxing.client.android.DecodeThread.run(DecodeThread.java:92)
01-23 17:09:34.770: I/PlatformSupportManager(24175): Using implementation class com.google.zxing.client.android.common.executor.HoneycombAsyncTaskExecInterface of interface com.google.zxing.client.android.common.executor.AsyncTaskExecInterface for SDK 11
01-23 17:09:34.775: I/AutoFocusManager(24175): Current focus mode 'auto'; use auto focus? true

Das Projekt kann man sich auch auf der Seite unten downloaden. Das ZXing sollte ich korrekt eingebunden haben, wie auch die core.jar erstellt etc. Leider kann ich die Projekte nicht anhängen, da die Dateien zu groß sind (auch gezippt). Wenn noch irgendwas fehlt, werde ich das nachliefern. Ich hoffe ihr könnt mir helfen :)

Danke schon im Voraus :)
 

Kevin007

Mitglied
Guten morgen, wow genau das selbe Problem hatte ich auch, mein Kumpel hat mir jedoch bei der Lösung dieses Problems geholfen. Als Infomatik Student hat man da nunmal gewisse Kniffe drauf ;-)
Allerdings hab ich noch ne kurze Frage. Bei den QR Codes, ist da eine gewisse Druckqualität maßgeblich oder reicht da auch etwas unter 300dpi?

Gruß und Danke
 

DerSchokoBär

Aktives Mitglied
@ Stroker89:
Danke, werde ich mir anschauen!

@ Kevin007:
Was hat er denn gemacht bzw. wäre es möglich den funktionierenden Code oder das Projekt zu schicken? Das wäre sehr hilfreich :)
 

Kevin007

Mitglied
Hi,

in Sachen Probmelanalyse bin ich da auch nicht der Profi drin, wie gesagt habe mir alles selbst beigebracht, aber ich frage ihn mal bei Gelegenheit, ob er sich dein Problem ansehen kann. Kann es nur nicht versprechen ;-)
 

DerSchokoBär

Aktives Mitglied
Wäre sehr hilfreich :)
Ist noch das Projekt mit dem Code vorhanden, geht ja wirklich nur um die Einbindung von ZXing, alles weitere wäre irrelevant und kann gelöscht werden.
 

Stroker89

Bekanntes Mitglied
Also ich kann die die Lib nur ans Herz legen. Ich stand vor einem ähnlichen Problem...:(
Bin dann auf die Lib gestoßen und hab mir viel ärger erspart.

Was ich noch weiß bei der Lib, dass die Layout XML File im Verzeichnis an erster Stelle stehen MUSS sonst funktioniert das Scannen nicht, warum auch immer. War sehr anstrengend auf diesen Fehler zu kommen, weil man sowas als letztes erwartet...

Gruß
 

DerSchokoBär

Aktives Mitglied
Danke die Lib funktioniert an sich wunderbar, das Scannen ebenfalls. Jedoch komme ich nicht darauf, wie man das Scan-Ergebnis abfangen/ übergeben kann?
 

Stroker89

Bekanntes Mitglied
Du hast ja die handleDecodeInternally()-Methode in der kannst du das machen :)

Java:
private void handleDecodeInternally(Result rawResult, ResultHandler resultHandler, Bitmap barcode) {
        onPause();
        
        Intent intent = new Intent(ScanCode.this, deinenächsteActivity.class);
        
        intent.putExtra("format", rawResult.getBarcodeFormat().toString());
        intent.putExtra("type", resultHandler.getType().toString());
        
        //Timestamp
        DateFormat formatter = DateFormat.getDateTimeInstance(DateFormat.SHORT,DateFormat.SHORT);
        String formattedTime = formatter.format(new Date(rawResult.getTimestamp()));
        String timestamp = Long.valueOf(rawResult.getTimestamp()).toString();
      
        intent.putExtra("time", timestamp);
        
        intent.putExtra("content", resultHandler.getDisplayContents().toString());
        
        //Hier könnte man sogar das aufgenommene Bild mit an eine Acitvity übergeben :)
        /*Bitmap result_img = barcode;
        ByteArrayOutputStream bs = new ByteArrayOutputStream();
        result_img.compress(Bitmap.CompressFormat.PNG, 50, bs);
        intent.putExtra("img", bs.toByteArray());*/
        
        startActivity(intent);
        this.finish();
    }

EDIT: Was noch zu erwähnen wäre ist, dass ich die zweite View die nach dem Scannen kommt, um die Daten darzustellen ausgeschalten habe und die Daten direkt an eine zweite Activity übergebe.

Viel Erfolg :)

Gruß
 
Zuletzt bearbeitet:

DerSchokoBär

Aktives Mitglied
Dankeschön :)
Blöde OT-Frage als Android-Einsteiger: Ich habe bei Android keine main(), die den Einstieg definiert. Wie kann ich dann besitmmen, welche Activity als erstes gestartet wird?
 

DerSchokoBär

Aktives Mitglied
Mh ja das habe ich mir schon gedacht, hab' jedoch keine Einstellungsmöglichkeiten gefunden und auch nichts in der XML gesehen, das darauf hinweist, Google ebenfalls:

[XML]<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.jwetherell.quick_response_code"
android:versionCode="1"
android:versionName="1.0">

<uses-sdk android:minSdkVersion="5" android:targetSdkVersion="5"/>

<uses-feature android:name="android.hardware.camera"/>
<uses-feature android:name="android.hardware.camera.autofocus" android:required="false"/>
<uses-feature android:name="android.hardware.touchscreen" android:required="false"/>

<uses-permission android:name="android.permission.CAMERA"/>

<application android:icon="@drawable/icon"
android:label="@string/app_name">
<activity android:name="de.example.app.Main"></activity>



<activity android:name=".DecoderActivity"
android:label="@string/decoder_name"
android:icon="@drawable/icon"
android:screenOrientation="landscape"
android:clearTaskOnLaunch="true"
android:stateNotNeeded="true"
android:configChanges="orientation|keyboardHidden"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
android:windowSoftInputMode="stateAlwaysHidden">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity><activity android:name=".CaptureActivity" android:label="@string/capture_name" android:icon="@drawable/icon" android:screenOrientation="landscape" android:clearTaskOnLaunch="true" android:stateNotNeeded="true" android:configChanges="orientation|keyboardHidden" android:theme="@android:style/Theme.NoTitleBar.Fullscreen" android:windowSoftInputMode="stateAlwaysHidden">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>

<activity android:name=".EncoderActivity"
...
</activity>
<activity android:name="de.example.app.Buch_einzeln"></activity>


</application>

</manifest>[/XML]

Hierarchisch liegt die "de.example.app.Main" ganz oben, allerdings wird nicht diese als erstes aufgerufen.
 

Stroker89

Bekanntes Mitglied
du musst der gewünschten Activity einen IntentFilter hinzufügen ;)

[XML]<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>[/XML]

sieht dann bei mir so aus:

[XML]<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name=".Activity_Start"
android:label="@string/title_activity_qmt_start"
android:screenOrientation="portrait" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>

...weitere Activities...

</application>
[/XML]

EDIT: Und aufpassen dass der IntentFilter nur bei deiner InitialActivity angegeben wird sonst wird die jede Activity auf dem Dashboard angezeigt...
 
Zuletzt bearbeitet:

spitzname

Mitglied
Hallo,
ich stehe gerade vor dem gleichen Problem, wie wurde das Problem den genau behoben, kann die angebotene modefizierte lib auf dem angebotenen Link leider nicht mehr finden. Vielleicht hat ja jemand einpaar Tipps für mich?

Gruß
 

Highlander

Mitglied
Hallo,
ich stehe gerade vor dem gleichen Problem, wie wurde das Problem den genau behoben, kann die angebotene modefizierte lib auf dem angebotenen Link leider nicht mehr finden. Vielleicht hat ja jemand einpaar Tipps für mich?

Gruß
Ist zwar schon ein wenig her, aber hier noch der Tip:
Dem Link zu Github folgen und dort rechts auf "Download ZIP" klicken
 
Ähnliche Java Themen

Ähnliche Java Themen

Neue Themen


Oben