teleop app android,java – 在android清单中没有默认构造函数

我的应用程序一直崩溃,它说:

java.lang.RuntimeException: Unable to start activity ComponentInfo{com.Hugler/com.Hugler.ActMain}:

android.content.ActivityNotFoundException: Unable to find explicit activity class {/com.Hugler.CB.SoundClsRslt};

have you declared this activity in your AndroidManifest.xml?

我在我的android清单文件中声明了活动,但是有一个错误说“’com.Hugler.CB.SoundClsRslt’没有默认构造函数”

android:allowBackup="true"

android:icon="@drawable/ic_launcher"

android:label="@string/Hugler"

android:theme="@android:style/Theme.Light.NoTitleBar.Fullscreen" >

android:name="com.Hugler.ActMain"

android:label="@string/Hugler" >

这是我的SoundClsRslt代码:

package com.Hugler.CB;

import java.io.File;

import java.io.FileOutputStream;

import java.io.IOException;

import java.nio.ByteBuffer;

import java.nio.ByteOrder;

import java.nio.ShortBuffer;

import java.nio.channels.FileChannel;

import java.text.SimpleDateFormat;

import java.util.Date;

import java.util.Locale;

import com.Hugler.ActMain;

import com.Hugler.TeleOp.TeleOp;

import com.SoundClassification.SoundClassification.ISC;

import android.app.Activity;

import android.content.Intent;

import android.os.Environment;

import android.telephony.SmsManager;

public class SoundClsRslt extends Activity implements ISC {

public static int interact;

private ActMain m_pMain;

private static int m_iID;

private static int m_iID1;

private FileOutputStream _fLog;

public SoundClsRslt(ActMain pMain) {

m_pMain = pMain;

m_iID = 0;

m_iID1 = 0;

_fLog = null;

}

public void StartLog(String sFile) {

if (_fLog != null)

return;

try {

_fLog = new FileOutputStream(sFile);

String sHdr = "Time,Event,Confidence\n";

_fLog.write(sHdr.getBytes());

} catch (Exception e) {

e.printStackTrace();

}

}

public void OnLog(String sLog) {

}

public void OnLog2(String sLog) {

}

public void OnSegment(double[] pBuf, int iLen, String sCls, double dConf) {

sCls = sCls.toLowerCase(Locale.getDefault());

{

if (sCls.contains("glass")) {

m_iID1++;

m_pMain.Show2(m_iID1 + "." + sCls);

m_pMain.Show3("" + dConf);

//convert short to byte

ByteBuffer myByteBuffer = ByteBuffer.allocate(iLen * 2);

myByteBuffer.order(ByteOrder.LITTLE_ENDIAN);

//open pcm

ShortBuffer myShortBuffer = myByteBuffer.asShortBuffer();

for (int i = 0; i < iLen ; i++) {

myShortBuffer.put((short)(pBuf[i]));

}

File file;

FileChannel out = null;

try {

String filepath = Environment.getExternalStorageDirectory().getPath();

SimpleDateFormat pSDF = new SimpleDateFormat("yyyyMMdd_HH_mm_ss", Locale.UK);

String sNow = pSDF.format(new Date());

file = new File(filepath,"AudioRecorder" + "/segment_" + sNow + ".pcm");

Intent intent = getIntent();

SimpleDateFormat smsdate = new SimpleDateFormat("yyyy/MM/dd_HH:mm:ss", Locale.US);

String messageToSend = "Glass breaking sound detected at "+ smsdate.format(new Date()) + " (yyyy/MM/dd_HH:mm:ss)";

String number = intent.getExtras().getString("numberfrom");

SmsManager.getDefault().sendTextMessage(number, null, messageToSend, null, null);

// if file doesnt exists, then create it

if (!file.exists()) {

file.createNewFile();

}

out = new FileOutputStream(file).getChannel();

//write to pcm

out.write(myByteBuffer);

//close pcm

out.close();

} catch (IOException e) {

e.printStackTrace();

} finally {

try {

if (out != null) {

out.close();

}

} catch (IOException e) {

e.printStackTrace();

}

}

} else {

m_iID++;

m_pMain.Show0(m_iID + "." + sCls);

m_pMain.Show1("" + dConf);

}

}

TeleOp.SendInteraction();

if (_fLog != null) {

SimpleDateFormat pSDF = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.US);

String sNow = pSDF.format(new Date());

String sLog = sNow + "," + sCls + "," + dConf + "\n";

try {

_fLog.write(sLog.getBytes());

} catch (IOException e) {

e.printStackTrace();

}

}

}

}

如何以及在何处添加空构造函数?提前致谢! 🙂

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值