小编Wor*_*ind的帖子

Android在TextView中显示Logcat

我正在构建的应用程序具有对Android的root访问权限.我希望在其中一个TextView中显示Logcat日志信息,以便在我调试时它可以显示在屏幕上.

有人可以给我一些想法,我可以调用哪些库/函数来访问这些日志?

谢谢

android android-logcat android-debug

9
推荐指数
1
解决办法
2万
查看次数

C#enum拼写纠错

我确信每个人在开发过程中都会在某处发生错字,并在发布后意识到这一点.好吧,我遇到了同样的问题,除了这个问题存在于Enum选项中.

我在C#中有一个如下所示的枚举定义

    public enum SlideShowZoomEffect
    {
        NoEffect,
        ZoomIn,
        ZoonOut
    }
Run Code Online (Sandbox Code Playgroud)

最近,在产品发布后,我们意识到ZoonOut有一个错字(它应该是ZoomOut).我们想要更改它,但它将作为字符串保存到数据库中(因此它保存为ZoonOut)并且程序将通过调用enum.parse(...)重新构建枚举,这允许我们在程序中将其用作枚举.

这里的问题是,一旦我们将ZoonOut更改为ZoomOut,是否有任何方法可以向后兼容,以便(字符串)ZoonOut和(字符串)ZoomOut将被解析为(枚举)ZoomOut?

任何建议都会很棒!

谢谢


更新(此问题的解决方案):

下面接受回答,这是我的测试代码,以显示对此接受的解决方案的影响,以供将来参考.谢谢你们

class Program
{
    static void Main(string[] args)
    {
        //Testing input as (string)ZoomOut
        Console.WriteLine("Testing #1: Input String = 'ZoomOut'");
        TestCase("ZoomOut");
        Console.WriteLine("\n\n\n");


        //Testing input as (string)ZoonOut
        Console.WriteLine("Testing #2: Input String = 'ZoonOut'");
        TestCase("ZoonOut");
        Console.WriteLine("\n\n\n");


        //Additional testing to ensure the TestCase function is working, we should see something else detected here
        Console.WriteLine("Testing #3: Input String = 'ZoomIn'");
        TestCase("ZoomIn");
    }


    static void TestCase(string inputString)
    {
        SlideShowZoomEffect enumInput = …
Run Code Online (Sandbox Code Playgroud)

c# enums

4
推荐指数
2
解决办法
483
查看次数

Android 将 MediaPlayer 连接到 VideoView

我正在开发一个 Android 项目,其中有一个 VideoView 和一个动态创建的 MediaPlayer 对象。我想知道,如何将我的 MediaPlayer(它已经准备好)连接到 VideoView Surface?

先谢谢大家

android android-mediaplayer android-videoview

1
推荐指数
1
解决办法
2971
查看次数