我试图将图像显示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;
}
}