小编Tar*_*uni的帖子

android中的Memory Analyzer工具?

我只想知道如何使用android中的Memory analyzer工具.请告诉我如何解决特定项目的内存泄漏问题.有人可以给我一步一步的程序.

android memory-leaks

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

如何在android中生成HMAC-SHA1签名?

这是我的基本字符串:

        String args ="oauth_consumer_key="+enc(consumerkey) +
                   "&oauth_nonce="+enc(generateNonce()) +
                   "&oauth_signature_method=HMAC-SHA1" +
                   "&oauth_timestamp="+ timestamp +
                   "&oauth_token="+enc(Home.consToken) +
                   "&oauth_verifier="+verifier+"&oauth_version=1.0";
                    String base ="POST&"+enc("https://api.linkedin.com/uas/oauth   /accessToken") +"&"+ enc(args);

       String signature =computeHmac(base,consumer_secret+"&"+secretToken);
Run Code Online (Sandbox Code Playgroud)

这是我的标题:

        String header = "OAuth " +
       "oauth_consumer_key=\""+ enc(consumerkey)+ "\"," +
       "oauth_nonce=\""+ enc(generateNonce()) + "\"," +
       "oauth_signature_method=\"HMAC-SHA1\"," +
       "oauth_timestamp=\""+ timestamp + "\"," +
       "oauth_token=\""+Home.consToken + "\"," +
       "oauth_signature=\""+enc(signature)+"\","+
       "oauth_verifier=\""+verifier +"\","+ 
       "oauth_version=\""+1.0+"\"" ;
Run Code Online (Sandbox Code Playgroud)

我使用以下方法生成签名:

public String computeHmac(String baseString, String key)
    throws NoSuchAlgorithmException, InvalidKeyException, IllegalStateException,  UnsupportedEncodingException
{
    Mac mac = Mac.getInstance("HmacSHA1");
    SecretKeySpec secret = new SecretKeySpec(key.getBytes(), mac.getAlgorithm());
    mac.init(secret); …
Run Code Online (Sandbox Code Playgroud)

android linkedin

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

无法在真实设备上检索Facebook的访问令牌

我在我的项目中进行了Facebook集成,在模拟器上一切都很好.当涉及在真实设备上运行时,它无法正常工作.我认为问题是Facebook访问令牌,我现在不知道该怎么办?所以我无法在真实设备上检索朋友信息.任何人都可以帮助我如何在真实设备上获取访问令牌.

我只使用Android SDK来获取Facebook好友信息.

mFacebook = new Facebook("api_id");
mFacebook.authorize(this, new String[] {
    "publish_stream", "read_stream", "offline_access", "friends_birthday", "user_birthday", "email", "read_friendlists", "manage_friendlists"
}, this);
sToken = mFacebook.getAccessToken();
public void onComplete(Bundle values) {
    Log.e("oncomplete", "value");
    if (values.isEmpty()) {
        Log.e("oncomplete", "value is empty");
        return;
    }
    if (!values.containsKey("POST")) {
        sToken = mFacebook.getAccessToken();
        getFriends()
    }
}
private void getFriends() {
    try {
        sToken = mFacebook.getAccessToken();
        StaticUtils.sResponseId = mFacebook.request("me/friends");
        Log.w("response", StaticUtils.sResponseId);
        try {
            JSONObject jObj = Util.parseJson(StaticUtils.sResponseId);
            JSONArray jArr = jObj.getJSONArray("data");
            for (int i = 0; i < …
Run Code Online (Sandbox Code Playgroud)

android facebook

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

使用手势识别数字

我想通过编码识别使用手势的数字.我已经认识到使用手势库.有没有可能完美地识别数字?

请提供任何示例代码.

android gesture-recognition

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

如何使用EPUBLIB阅读EPUB书?

我找到了一个使用epublib在android中阅读epub书籍的解决方案.我能够阅读这本书的字幕.但我没有找到一种方法来逐行阅读内容.我该如何实现这一目标?

获取图书标题的示例代码是

  private void logTableOfContents(List<TOCReference> tocReferences, int depth) {
    if (tocReferences == null) {
        return;
    }
    for (TOCReference tocReference : tocReferences) {
        StringBuilder tocString = new StringBuilder();
        StringBuilder tocHref=new StringBuilder();
        for (int i = 0; i < depth; i++) {
            tocString.append("\t");
            tocHref.append("\t");
        }
        tocString.append(tocReference.getTitle());

        tocHref.append(tocReference.getCompleteHref());
        Log.e("Sub Titles", tocString.toString());
        Log.e("Complete href",tocHref.toString());

        //logTableOfContents(tocReference.getChildren(), depth + 1);
    }
}
Run Code Online (Sandbox Code Playgroud)

http://www.siegmann.nl/epublib/android获得此代码

我怎样才能得到这本书的故事......

android epub epublib

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

设备和模拟器上的OutOfMemory

我在模拟器和设备(acer tablet and samsung galaxy)上运行我的项目时出现OutOfMemory Exception

应用程序启动程序进程com.android.launcher意外停止.

我已将模拟器的虚拟机大小增加到256mb,但该异常没有变化.我怎样才能避免这种异常?如何为模拟器和设备增加堆的进程大小?

请参考这个问题

android out-of-memory android-emulator

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

经常绘制线条

我处于一种情况,我想在一段时间内逐一画线.我试图通过使用thread来做到这一点.但它对我没用.目标是我有5行.这些行应该一个接一个地绘制,延迟时间为5秒.在onDraw()方法中使用Thread.sleep(5000),但是在5秒后绘制了所有行,这些行不是定期绘制的...我如何定期绘制线...

代码片段::

  public class PaintDemoActivity extends Activity {
DragView drawView;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
            WindowManager.LayoutParams.FLAG_FULLSCREEN);
    requestWindowFeature(Window.FEATURE_NO_TITLE);

    drawView = new DragView(this);
    setContentView(drawView);
    drawView.requestFocus();
}
Run Code Online (Sandbox Code Playgroud)

}

DragView类::

     public class DragView extends View implements OnTouchListener {
     Paint paint = new Paint();
     public DragView(Context context) {
    super(context);
    setFocusable(true);
    setFocusableInTouchMode(true);

    this.setOnTouchListener(this);

    paint.setColor(Color.GREEN);
    paint.setStyle(Paint.Style.FILL);
    //paint.setStyle(Style.STROKE);
    paint.setAntiAlias(true);
}
   @Override
public void onDraw(final Canvas mCanvas) {  
    canvas.drawCircle(p.x, p.y, 5, paint);
    canvas.drawLine(60, 60, 120,60, paint);
    canvas.drawLine(60, …
Run Code Online (Sandbox Code Playgroud)

android paint lines

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