小编fer*_*tar的帖子

Android模拟器:设置移动设备号码?

有谁知道是否可以设置模拟器的手机号码?我无法在任何地方找到相关信息.谢谢.

android emulation

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

Android Proguard问题

使用proguard似乎很混乱.我有兴趣简单地在我的应用程序中混淆一些软件包.我在windows中使用最新的Android API设置了eclipse.我添加了默认的proguard.cfg来构建我的应用程序没有问题,但是当我运行应用程序时,应用程序的某些功能不再起作用.它只是奇怪的东西.

此外,每当我创建一个新项目时,它永远不会自动创建proguard.cfg,我不知道为什么.但我可以找到它

android-sdk-windows\tools\lib
Run Code Online (Sandbox Code Playgroud)

我真正感兴趣的是在我的代码中混淆某些包甚至几个类.如果我能做到这一点,我会非常满意.有没有简单的方法来说"混淆这个".你们可以分享的任何基本配置?

android proguard

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

如何在Rack :: Test中发布数据

我在理解如何使用Rack :: Test时遇到问题,我遇到的问题是POST.这是类和错误:

hellotesting.rb

require 'sinatra'

post '/foo' do 
    "Hello #{params[:name]}."
end 
Run Code Online (Sandbox Code Playgroud)

这是测试:

require 'hellotesting'
require 'test/unit'
require 'rack/test'

set :environment, :test

class HelloWorldTest < Test::Unit::TestCase
    def test_it_says_hello_to_you
        browser = Rack::Test::Session.new(Rack::MockSession.new(Sinatra::Application))
    post "/foo", "name" => "Bryan"
        assert browser.last_response.ok?
        assert_equal 'Hello Bryan', browser.last_response.body
   end
end
Run Code Online (Sandbox Code Playgroud)

并输出:

1) Error:
test_it_says_hello_to_you(HelloWorldTest):
ArgumentError: wrong number of arguments (1 for 0)
/Library/Ruby/Gems/1.8/gems/sinatra-1.2.6/lib/sinatra/base.rb:1141:in `name'
/Library/Ruby/Gems/1.8/gems/sinatra-1.2.6/lib/sinatra/base.rb:1141:in `send'
/Library/Ruby/Gems/1.8/gems/sinatra-1.2.6/lib/sinatra/base.rb:1141:in `compile!'
/Library/Ruby/Gems/1.8/gems/sinatra-1.2.6/lib/sinatra/base.rb:1141:in `each_pair'
/Library/Ruby/Gems/1.8/gems/sinatra-1.2.6/lib/sinatra/base.rb:1141:in `compile!'
/Library/Ruby/Gems/1.8/gems/sinatra-1.2.6/lib/sinatra/base.rb:1129:in `route'
/Library/Ruby/Gems/1.8/gems/sinatra-1.2.6/lib/sinatra/base.rb:1118:in `post'
(__DELEGATE__):3:in `send'
(__DELEGATE__):3:in `post'
testingjeison.rb:11:in `test_it_says_hello_to_you'
Run Code Online (Sandbox Code Playgroud)

ruby rack sinatra

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

在Android中运行时更新视图

这个例子非常简单:我想通过显示文本(canvas.drawText())让用户知道应用程序正在做什么.然后,我的第一条消息出现,但不是其他消息.我的意思是,我有一个"setText"方法,但它没有更新.

onCreate(Bundle bundle) {
    super.onCreate(bundle);
    setContentView(splash); // splash is the view class
    loadResources();
    splash.setText("this");
    boundWebService();
    splash.setText("that"):
    etc();
    splash.setText("so on");
}
Run Code Online (Sandbox Code Playgroud)

视图的文本绘图只需在onDraw();中执行drawText,因此setText会更改文本但不会显示它.

有人建议我用SurfaceView替换视图,但是对于几个更新来说会有很多麻烦,所以...我怎么能在运行时以动态更新视图?

它应该很简单,只显示2秒的文本,然后主线程做他的东西,然后更新文本...

谢谢!

更新:

我尝试实现handler.onPost(),但是又重复了同样的故事.我给你看一下代码:

public class ThreadViewTestActivity extends Activity {

Thread t;
Splash splash;

/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    splash = new Splash(this);
    t = new Thread(splash);
    t.start();

    splash.setTextow("OA");
    try { Thread.sleep(4000); } catch (InterruptedException e) { }
    splash.setTextow("LALA");
}       
}
Run Code Online (Sandbox Code Playgroud)

和:

public class Splash implements …
Run Code Online (Sandbox Code Playgroud)

java user-interface android view handler

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

Haskell中元组内部函数出错

我正在玩Haskell一点点,我使用带有元组的snd函数(String,list)时遇到了这个错误.

snd ("Felix Felices",[("Escarabajos Machacados",52,[f1,f2]),("Ojo de Tigre Sucio",2,[f2])])
ERROR - Cannot find "show" function for:
*** Expression : snd ("Felix Felices",[("Escarabajos Machacados",52,[f1,f2]),("Ojo de Tigre Sucio",2,[f2])])
*** Of type    : [([Char],Integer,[(Integer,Integer,Integer) -> (Integer,Integer,Integer)])]
Run Code Online (Sandbox Code Playgroud)

问题是,如果我删除f1,f2和f3(它们是函数)代码工作正常,它返回列表.为什么会发生这种情况,为什么我不能将一个函数放在元组的第二个位置?

haskell functional-programming

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

Android - 如何以编程方式更改ImageButton的宽度?

我有一个ImageButton.代码是 -

ImageButton shareButton = new ImageButton(this);
shareButton.setBackgroundResource(android.R.drawable.ic_menu_share);

RelativeLayout.LayoutParams shareParams = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
shareParams.addRule(RelativeLayout.ALIGN_PARENT_RIGHT, navigationLogo.getId());

shareButton.setLayoutParams(shareParams);
Run Code Online (Sandbox Code Playgroud)

我需要改变它的宽度.但是ImageButton和布局参数都没有setWidth方法.在没有答案的情况下在网上看了很多.

android width imagebutton

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