Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9265563
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T14:05:52+00:00 2026-06-18T14:05:52+00:00

I’m creating an Android app which uses the Microsoft Hawaii SDK to perform the

  • 0

I’m creating an Android app which uses the Microsoft Hawaii SDK to perform the OCR of a pic taken with the cellphone camera. I’ve an error during the execution of my Android app.
the log cat is this:

02-07 14:48:59.617: E/AndroidRuntime(24660): FATAL EXCEPTION: main
02-07 14:48:59.617: E/AndroidRuntime(24660): java.lang.NoClassDefFoundError: com.example.mobile.RecognitionActivity
02-07 14:48:59.617: E/AndroidRuntime(24660):    at com.example.mobile.FotocameraActivity.onActivityResult(FotocameraActivity.java:143)
02-07 14:48:59.617: E/AndroidRuntime(24660):    at android.app.Activity.dispatchActivityResult(Activity.java:4820)
02-07 14:48:59.617: E/AndroidRuntime(24660):    at android.app.ActivityThread.deliverResults(ActivityThread.java:2980)
02-07 14:48:59.617: E/AndroidRuntime(24660):    at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2435)
02-07 14:48:59.617: E/AndroidRuntime(24660):    at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:2476)
02-07 14:48:59.617: E/AndroidRuntime(24660):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1990)
02-07 14:48:59.617: E/AndroidRuntime(24660):    at android.app.ActivityThread.handleRelaunchActivity(ActivityThread.java:3355)
02-07 14:48:59.617: E/AndroidRuntime(24660):    at android.app.ActivityThread.access$700(ActivityThread.java:127)
02-07 14:48:59.617: E/AndroidRuntime(24660):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1155)
02-07 14:48:59.617: E/AndroidRuntime(24660):    at android.os.Handler.dispatchMessage(Handler.java:99)
02-07 14:48:59.617: E/AndroidRuntime(24660):    at android.os.Looper.loop(Looper.java:137)
02-07 14:48:59.617: E/AndroidRuntime(24660):    at android.app.ActivityThread.main(ActivityThread.java:4476)
02-07 14:48:59.617: E/AndroidRuntime(24660):    at java.lang.reflect.Method.invokeNative(Native Method)
02-07 14:48:59.617: E/AndroidRuntime(24660):    at java.lang.reflect.Method.invoke(Method.java:511)
02-07 14:48:59.617: E/AndroidRuntime(24660):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:816)
02-07 14:48:59.617: E/AndroidRuntime(24660):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:583)
02-07 14:48:59.617: E/AndroidRuntime(24660):    at dalvik.system.NativeStart.main(Native Method)

The code of FotocameraActivity.Java is this:

package com.example.mobile;

import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.Rect;
import android.location.GpsStatus;
import android.location.GpsStatus.Listener;
import android.location.Location;
import android.location.LocationListener;
import android.location.LocationManager;
import android.net.Uri;
import android.os.Bundle;
import android.provider.MediaStore;
import android.util.Log;

import android.view.View;
import android.widget.ImageView;

public class FotocameraActivity extends Activity {


   // dati che servono per la fotocamera
private static final int CAMERA_REQUEST = 100; // un numero a nostro
                                                                                                // piacimento
File tmpFotoFile = null;
byte[] bitmapdata;
ImageView preview;
LocationManager locationManager;
String gps;
final static String ARRAY_BYTE = "ARRAY_BYTE";
final static String GPS = "GPS";

@Override
public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        locationManager = (LocationManager)this.getSystemService(Context.LOCATION_SERVICE);
        if(locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER)){
        startGpsTracking();
        }

        try {
                launchCamera();
        } catch (IOException e) {
                throw new RuntimeException(e);
        }
}

private void startGpsTracking() {
         // TODO Auto-generated method stub
         locationManager.addGpsStatusListener(gpsListener);
         locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 500, 3, myLocationListener);
   }

private Listener gpsListener = new Listener(){
   public void onGpsStatusChanged(int status){
         switch(status){
         case GpsStatus.GPS_EVENT_FIRST_FIX:
                Log.d(LOCATION_SERVICE,"onGpsStatusChanged First Fix");
                break;
         case GpsStatus.GPS_EVENT_SATELLITE_STATUS:
                Log.d(LOCATION_SERVICE, "onGpsStatusChanged Satellite");
                break;
         case GpsStatus.GPS_EVENT_STARTED:
                Log.d(LOCATION_SERVICE, "onGpsStatusChanged Started");
                break;
         case GpsStatus.GPS_EVENT_STOPPED:
                Log.d(LOCATION_SERVICE, "onGpsStatusChanged Stopped");
                break;
         }
   }
};

private LocationListener myLocationListener = new LocationListener(){

         public void onLocationChanged(Location location) {
                // TODO Auto-generated method stub
                double lng = location.getLongitude(), lat = location.getLatitude();
                gps += String.format("%6f", lng) + "#" + String.format("%6f", lat); 

         }

         public void onProviderDisabled(String provider) {
                // TODO Auto-generated method stub

         }

         public void onProviderEnabled(String provider) {
                // TODO Auto-generated method stub

         }

         public void onStatusChanged(String provider, int status, Bundle extras) {
                // TODO Auto-generated method stub

         }

};

   private void launchCamera() throws IOException {

        // Fase 1
        tmpFotoFile = File.createTempFile("OCRPic", null);

        Intent cameraIntent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
        cameraIntent.putExtra(MediaStore.EXTRA_OUTPUT, android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI); //Uri.fromFile(tmpFotoFile));
        startActivityForResult(cameraIntent, CAMERA_REQUEST);
}

protected void onActivityResult(int requestCode, int resultCode, Intent data) {

        if (requestCode == CAMERA_REQUEST) {
                Bitmap datifoto = null;
                Uri picUri = data.getData();
                if(picUri != null){

                       try {
                              datifoto = android.provider.MediaStore.Images.Media.getBitmap(this.getContentResolver(), picUri);
                              //datifoto = android.provider.MediaStore.Images.Media.getBitmap(this.getContentResolver(), android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);//Uri.fromFile(tmpFotoFile));
                              } catch (FileNotFoundException e) {
                                    throw new RuntimeException(e);
                              } catch (IOException e) {
                                    throw new RuntimeException(e);
                              }
                }
                       ByteArrayOutputStream bos = new ByteArrayOutputStream();
                       datifoto.compress(Bitmap.CompressFormat.JPEG, 70, bos);
                       bitmapdata = bos.toByteArray();
                       //tmpFotoFile.delete();

                SimpleView view = new SimpleView(this, datifoto); // creo l'istanza
                                                                                                                        // // della                                                                                                       // view...
                setContentView(view); // e la setto

                Intent intentRecognize = new Intent(this, RecognitionActivity.class); **<-Here refers the logcat for the error**
                intentRecognize.putExtra(ARRAY_BYTE, bitmapdata);
                intentRecognize.putExtra(GPS, gps);
                startActivity(intentRecognize);
        }

}
   }


class SimpleView extends View{

private Bitmap bitmap;
private Paint tmpPaint = new Paint(Paint.ANTI_ALIAS_FLAG);

public SimpleView(Context context, Bitmap bitmap) {
        super(context);
        this.bitmap = Bitmap.createScaledBitmap(bitmap,480,320,false);//ridimensiono l'immagine
}

@SuppressLint("DrawAllocation")
@Override
protected void onDraw(Canvas canvas){
super.onDraw(canvas);
canvas.drawBitmap( bitmap, null , new Rect(0,0,getWidth(),getHeight()),tmpPaint);
}


}

While the code of RecognitionActivity.Java is this:

package com.example.mobile;

import android.os.Bundle;
import android.view.Menu;
import android.view.View;
import android.widget.TextView;
import microsoft.hawaii.sampleappbase.HawaiiBaseAuthActivity;


public class RecognitionActivity extends HawaiiBaseAuthActivity {

private TextView tv;
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_recognition);

    tv.setText("Prova");
    tv.setVisibility(View.VISIBLE);

}

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    // Inflate the menu; this adds items to the action bar if it is present.
    getMenuInflater().inflate(R.menu.activity_recognition, menu);
    return true;
}

}

I noticed that, in RecognitionActivity, if I extend that activity from Activity, it works, but if I extend HawaiiBaseAuthActivity, it crashes.

I noticed another message in the logcat, that appears just in the moment that the app starts:

02-07 14:48:14.717: E/dalvikvm(24660): Could not find class 'com.example.mobile.RecognitionActivity', referenced from method com.example.mobile.FotocameraActivity.onActivityResult

But that activity is defined in my workspace!

I will appreciate very much if someone can help me.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T14:05:54+00:00Added an answer on June 18, 2026 at 2:05 pm

    have you added com.example.mobile.RecognitionActivity to the AndroidManifest.xml?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am writing an app for my school newspaper, which is run completely online
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I am trying to understand how to use SyndicationItem to display feed which is
I used javascript for loading a picture on my website depending on which small
I would like to run a str_replace or preg_replace which looks for certain words
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
We're building an app, our first using Rails 3, and we're having to build
I have an autohotkey script which looks up a word in a bilingual dictionary
I have an array which has BIG numbers and small numbers in it. I
I have a text area in my form which accepts all possible characters from

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.