如果我离开我的应用程序并在一段时间后打开它,我会收到此异常.我的主要活动包括一个包含三个不同片段的ViewPager.我也在Application类中做了一些我不认为与问题有关的东西.
这是例外:
RuntimeException(@Parcel:readValue:2065){无法启动活动ComponentInfo {com.emu/com.emu.ActivityMain}:java.lang.RuntimeException:Parcel android.os.Parcel@419526d0:在332处解组未知类型代码2131361816 }
我发现谷歌分析中的用户手机上发生了很多这种异常.所有这些都是相同的,除了@v之后的数字和@之后的十六进制数,在上面的异常中是2065和419526d0.
该异常并未指出任何代码行.我搜索了这个,似乎与错误写入包裹有关.虽然我的MainActivity中没有任何包裹.我不知道是什么原因引起的.
---编辑---------------------------------------------- --------------------------
我转载了例外.它发生在应用程序离开主页按钮,并在打开其他内存消耗应用程序后从内存中清除.再次启动它时会发生异常.直到现在我才认为从最近的任务或从DDMS关闭应用程序具有相同的效果,但显然它没有.
@EricWoodruf帮我发现包裹在进口图书馆的某个地方.我在PagerSlidingTabStrip中找到了我从网上下载的包裹.这是与包裹相关的代码,但我真的不知道这里有什么问题:
public class PagerSlidingTabStrip extends HorizontalScrollView
{
@Override
public void onRestoreInstanceState(Parcelable state)
{
SavedState savedState = (SavedState) state;
super.onRestoreInstanceState(savedState.getSuperState());
currentPosition = savedState.currentPosition;
requestLayout();
}
@Override
public Parcelable onSaveInstanceState()
{
Parcelable superState = super.onSaveInstanceState();
SavedState savedState = new SavedState(superState);
savedState.currentPosition = currentPosition;
return savedState;
}
static class SavedState extends BaseSavedState
{
int currentPosition;
public SavedState(Parcelable superState)
{
super(superState);
}
private SavedState(Parcel in)
{
super(in);
currentPosition = in.readInt();
}
@Override
public …
Run Code Online (Sandbox Code Playgroud) 我正在编写一个取决于网络活动的Android应用程序,警报管理器有时会将手机从睡眠状态唤醒.
我的问题是如何在设备上可靠地测试?理想情况下,我如何强制手机进入全开睡眠状态.如果做不到这一点,我怎么能确定电话完全进入睡眠状态?
如何测试警报管理器/唤醒锁定/睡眠处理代码?
Camera.setDisplayOrientation 的文档页面包含以下代码示例,声明使用它将"使摄像机图像以与显示相同的方向显示":
public static void setCameraDisplayOrientation(Activity activity,
int cameraId, android.hardware.Camera camera) {
android.hardware.Camera.CameraInfo info =
new android.hardware.Camera.CameraInfo();
android.hardware.Camera.getCameraInfo(cameraId, info);
int rotation = activity.getWindowManager().getDefaultDisplay()
.getRotation();
int degrees = 0;
switch (rotation) {
case Surface.ROTATION_0: degrees = 0; break;
case Surface.ROTATION_90: degrees = 90; break;
case Surface.ROTATION_180: degrees = 180; break;
case Surface.ROTATION_270: degrees = 270; break;
}
int result;
if (info.facing == Camera.CameraInfo.CAMERA_FACING_FRONT) {
result = (info.orientation + degrees) % 360;
result = (360 - result) % 360; // …
Run Code Online (Sandbox Code Playgroud) 我正在制作一个新的(空模板)ASP.NET MVC 5应用程序,我无法注销这个应用程序.我的注销行动:
public ActionResult LogOff()
{
if (User.Identity.IsAuthenticated)
{
//break here
}
try
{
AuthenticationManager.SignOut();
if (User.Identity.IsAuthenticated || Request.IsAuthenticated)
{
//break here;
}
}
return RedirectToAction("Login", "Account");
}
Run Code Online (Sandbox Code Playgroud)
启动课程:
public partial class Startup
{
public void ConfigureAuth(IAppBuilder app)
{
app.UseCookieAuthentication(new CookieAuthenticationOptions
{
AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie,
LoginPath = new PathString("/Account/Login")
});
app.UseExternalSignInCookie(DefaultAuthenticationTypes.ExternalCookie);
}
}
Run Code Online (Sandbox Code Playgroud)
应用背景:
public class ApplicationDbContext : IdentityDbContext<ApplicationUser>
{
public ApplicationDbContext()
: base("DefaultConnection", false)
{
}
}
Run Code Online (Sandbox Code Playgroud)
连接字符串:
<connectionStrings>
<add name="DefaultConnection" connectionString="Server=.;Database=DataTest;Trusted_Connection=True;" providerName="System.Data.SqlClient" />
</connectionStrings>
Run Code Online (Sandbox Code Playgroud)
操作LogOff()执行没有问题,并将我重定向到"登录"操作,但我仍然登录.它有什么问题?
在测试应用程序时,我遇到了一个奇怪的行为.一些测试使用模拟以不同的用户身份运行代码,但它们总是挂起,永远不会完成.
经过一番调查后,问题被缩小到使用互斥量.最初,我们使用了基于MSDN文档的我们自己的模拟代码,但即使使用SimpleImpersonation库,问题仍然存在.以下是重现问题的最小示例:
using (Impersonation.LogonUser(DOMAIN, USER, PASSWORD, LogonType.Interactive))
{
Console.WriteLine("Impersonated");
bool mine;
using (new Mutex(true, "Mutex", out mine))
{
if (!mine)
throw new Exception("Couldn't get mutex");
Console.WriteLine("Got mutex");
}
}
Console.WriteLine("Finished");
Run Code Online (Sandbox Code Playgroud)
这永远不会完成,它与互斥锁创建一致.该文件指出,它要么抛出一个异常,或返回的东西,但没有提到封锁.
其他一些观察结果,可能与也可能没有关系:
可能底层系统资源正在发生,但我们无法弄明白.如何使这项工作?
更新:根据汉斯的评论,我尝试禁用Windows Defender,它没有帮助.这是挂起的地方的堆栈跟踪:
ntdll.dll!_NtWaitForSingleObject@12()
KernelBase.dll!_WaitForSingleObjectEx@12()
mscorlib.ni.dll!719c1867()
[Frames below may be incorrect and/or missing, native debugger attempting to walk managed call stack]
mscorlib.ni.dll!719c1852()
[Managed to Native Transition]
mscorlib.dll!System.Threading.Mutex.CreateMutexHandle(bool initiallyOwned, string name, Microsoft.Win32.Win32Native.SECURITY_ATTRIBUTES securityAttribute, out Microsoft.Win32.SafeHandles.SafeWaitHandle mutexHandle)
mscorlib.dll!System.Threading.Mutex.MutexTryCodeHelper.MutexTryCode(object userData)
[Native to …
Run Code Online (Sandbox Code Playgroud) 此代码显示“注册”链接;我想将此链接重定向到“ www.myDomain.com/register/”,该如何更改?
<?php
if ( get_option( 'users_can_register' ) ) :
$registration_url = sprintf( '<a href="%s">%s</a>', esc_url( wp_registration_url() ), __( 'Register' ) );``/*** Filter the registration URL below the login form.
** @since 1.5.2** @param string $registration_url Registration URL.
*/echo ' | ' . apply_filters( 'register', $registration_url );endif;?></p>
Run Code Online (Sandbox Code Playgroud) 我的查询中出现无法解决的错误:
我的查询:
SELECT [subject], cal
FROM (
SELECT [subject], cal
FROM amir
WHERE textfilter LIKE '% word %') a
WHERE lev=3 AND cal between '6/10/2012' AND '3/11/2013'
Run Code Online (Sandbox Code Playgroud)
错误发生在"lev = 3"
Msg 207, Level 16, State 1, Line 2
Invalid column name 'lev'.
Run Code Online (Sandbox Code Playgroud)
我的表列是:
[RecordId] [bigint] IDENTITY(1,1) NOT NULL,
[text] [nvarchar](max) NOT NULL,
[textfilter] [nvarchar](max) NOT NULL,
[mo] [int] NULL,
[loc] [int] NULL,
[lev] [int] NOT NULL,
[cal] [date] NOT NULL,
CONSTRAINT [PK_SahifehEmam] PRIMARY KEY CLUSTERED
Run Code Online (Sandbox Code Playgroud)