【发布时间】:2014-10-25 18:05:01
【问题描述】:
我正在尝试将图像显示 7 秒并将其隐藏。但是当我运行我的应用程序时,它显示跳过了 127 帧,应用程序可能在其主线程上做了太多工作。如何消除此错误?这是我的代码 // 版权所有 2007-2014 metaio GmbH。版权所有。 包 com.donseenu.two;
import android.content.Intent;
import android.net.Uri;
import android.util.Log;
import android.view.View;
import android.widget.ImageView;
import com.metaio.sdk.ARViewActivity;
import com.metaio.sdk.MetaioDebug;
import com.metaio.sdk.jni.IGeometry;
import com.metaio.sdk.jni.IMetaioSDKCallback;
import com.metaio.tools.io.AssetsManager;
public class Template extends ARViewActivity
{
@Override
protected int getGUILayout()
{
// Attaching layout to the activity
return R.layout.tutorial_hello_world;
}
public void onButtonClick(View v)
{
finish();
}
@Override
protected void loadContents()
{
this.runOnUiThread(new Runnable() {
@Override
public void run() {
try{
Thread.sleep(7000);
}
catch(Exception e)
{
}
ImageView image = (ImageView)findViewById(R.id.remove);
image.setVisibility(View.GONE);
}
});
try
{
// Getting a file path for tracking configuration XML file
String trackingConfigFile = AssetsManager.getAssetPath(getApplicationContext(), "TrackingData_MarkerlessFast.xml");
// Assigning tracking configuration
boolean result = metaioSDK.setTrackingConfiguration(trackingConfigFile);
MetaioDebug.log("Tracking data loaded: " + result);
// Getting a file path for a 3D geometry
String metaioManModel = AssetsManager.getAssetPath(getApplicationContext(), "augmented_city.obj");
if (metaioManModel != null)
{
// Loading 3D geometry
IGeometry geometry = metaioSDK.createGeometry(metaioManModel);
if (geometry != null)
{
// Set geometry properties
geometry.setScale(4f);
}
else
MetaioDebug.log(Log.ERROR, "Error loading geometry: "+metaioManModel);
}
}
catch (Exception e)
{
MetaioDebug.printStackTrace(Log.ERROR, e);
}
}
@Override
protected void onGeometryTouched(IGeometry geometry)
{
// Not used in this tutorial
}
@Override
protected IMetaioSDKCallback getMetaioSDKCallbackHandler()
{
// No callbacks needed in this tutorial
return null;
}
}
【问题讨论】: