论坛首页 移动开发技术论坛

Android腾讯微薄客户端开发十五:终结篇(分享源代码)

浏览 91554 次
该帖已经被评为精华帖
作者 正文
   发表时间:2011-08-01  
helloandroid 写道
cheney_love 写道
helloandroid 写道
我找了我两个朋友,测试了一下,是成功运行的

楼主,为什么登录之后就跳转到帐号管理界面,没数据昵。


你点击一下添加账号,需要跳往腾讯的授权页面来登录,然后再返回此界面才能有数据

点击了,在里面添加完帐号,点授权之后,好像快速的跳转到一个“找不到……”的界面,然后又跳转回了此界面,谢谢。
0 请登录后投票
   发表时间:2011-08-01   最后修改:2011-08-01
cheney_love 写道
helloandroid 写道
cheney_love 写道
helloandroid 写道
我找了我两个朋友,测试了一下,是成功运行的

楼主,为什么登录之后就跳转到帐号管理界面,没数据昵。


你点击一下添加账号,需要跳往腾讯的授权页面来登录,然后再返回此界面才能有数据

点击了,在里面添加完帐号,点授权之后,好像快速的跳转到一个“找不到……”的界面,然后又跳转回了此界面,谢谢。

那个找不到得界面是因为 腾讯微博API的CallbackUrl 造成的(我设置了值),

,你看看ddms里面的打印信息,看看有没有报错信息,看看数据库里面插入数据没有?
  • 大小: 8.1 KB
0 请登录后投票
   发表时间:2011-08-01  
好的,谢谢LZ,还有个问题,我如果不用eclipse启动,通过桌面图标点击启动,会报程序异常终止的错误,不知道怎么回事尼,这个需要在windows下运行么?
0 请登录后投票
   发表时间:2011-08-01  
cheney_love 写道
好的,谢谢LZ,还有个问题,我如果不用eclipse启动,通过桌面图标点击启动,会报程序异常终止的错误,不知道怎么回事尼,这个需要在windows下运行么?

等等,我去试一试我的从虚拟机的桌面启动微博
0 请登录后投票
   发表时间:2011-08-01   最后修改:2011-08-01
cheney_love 写道
好的,谢谢LZ,还有个问题,我如果不用eclipse启动,通过桌面图标点击启动,会报程序异常终止的错误,不知道怎么回事尼,这个需要在windows下运行么?

我刚刚试了下,直接用AVD启动的模拟器,然后点我的微博的应用程序图标,没有报错,能正常显示。没有用eclipse来启动,你是不是点击得太猛太快了,有时候用其它程序如果操作太猛太快的话我也会出现这种错误。
0 请登录后投票
   发表时间:2011-08-01  
helloandroid 写道
cheney_love 写道
好的,谢谢LZ,还有个问题,我如果不用eclipse启动,通过桌面图标点击启动,会报程序异常终止的错误,不知道怎么回事尼,这个需要在windows下运行么?

我刚刚试了下,直接用AVD启动的模拟器,然后点我的微博的应用程序图标,没有报错,能正常显示。没有用eclipse来启动,你是不是点击得太猛太快了,有时候用其它程序如果操作太猛太快的话我也会出现这种错误。

谢谢,helloandroid,我到windows 下面去看看……
0 请登录后投票
   发表时间:2011-08-01  
LZ你好,我的报如下错误,从返回的json数据来看,应该是验证通过了,应该是数据库的地方有问题吧
08-01 14:48:34.654: WARN/System.err(328): java.lang.NullPointerException
08-01 14:48:34.679: WARN/System.err(328):     at java.io.ByteArrayInputStream.<init>(ByteArrayInputStream.java:62)
08-01 14:48:34.679: WARN/System.err(328):     at com.android.caigang.db.DataHelper.GetUserList(DataHelper.java:50)
08-01 14:48:34.684: WARN/System.err(328):     at com.android.caigang.view.AccountActivity$1.onReceive(AccountActivity.java:220)
08-01 14:48:34.684: WARN/System.err(328):     at android.app.ActivityThread$PackageInfo$ReceiverDispatcher$Args.run(ActivityThread.java:892)
08-01 14:48:34.701: WARN/System.err(328):     at android.os.Handler.handleCallback(Handler.java:587)
08-01 14:48:34.704: WARN/System.err(328):     at android.os.Handler.dispatchMessage(Handler.java:92)
08-01 14:48:34.704: WARN/System.err(328):     at android.os.Looper.loop(Looper.java:123)
08-01 14:48:34.704: WARN/System.err(328):     at android.app.ActivityThread.main(ActivityThread.java:4627)
08-01 14:48:34.704: WARN/System.err(328):     at java.lang.reflect.Method.invokeNative(Native Method)
08-01 14:48:34.704: WARN/System.err(328):     at java.lang.reflect.Method.invoke(Method.java:521)
08-01 14:48:34.704: WARN/System.err(328):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
08-01 14:48:34.714: WARN/System.err(328):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
08-01 14:48:34.714: WARN/System.err(328):     at dalvik.system.NativeStart.main(Native Method)
08-01 14:48:34.714: ERROR/AccountActivity(328): {"data":{"birth_day":1,"birth_month":1,"birth_year":1987,"city_code":"1","country_code":"1","edu":null,"email":"","fansnum":20,"head":"","idolnum":2,"introduction":"","isent":0,"isvip":0,"location":"山东 济南","name":"cheney_life","nick":"漫步云端","province_code":"37","sex":1,"tag":null,"tweetnum":33,"verifyinfo":""},"errcode":0,"msg":"ok","ret":0}
08-01 14:48:34.724: ERROR/AccountActivity(328): 593848
08-01 14:48:34.764: WARN/ActivityManager(59): Duplicate finish request for HistoryRecord{44fb7978 com.android.caigang/.view.AuthorizeActivity}
08-01 14:48:35.424: DEBUG/dalvikvm(328): GC_FOR_MALLOC freed 8509 objects / 470752 bytes in 92ms
08-01 14:48:35.474: ERROR/Cursor(328): Finalizing a Cursor that has not been deactivated or closed. database = /data/data/com.android.caigang/databases/weibo.db, table = users, query = SELECT * FROM users ORDER BY _id DESC
08-01 14:48:35.474: ERROR/Cursor(328): android.database.sqlite.DatabaseObjectNotClosedException: Application did not close the cursor or database object that was opened here
08-01 14:48:35.474: ERROR/Cursor(328):     at android.database.sqlite.SQLiteCursor.<init>(SQLiteCursor.java:210)
08-01 14:48:35.474: ERROR/Cursor(328):     at android.database.sqlite.SQLiteDirectCursorDriver.query(SQLiteDirectCursorDriver.java:53)
08-01 14:48:35.474: ERROR/Cursor(328):     at android.database.sqlite.SQLiteDatabase.rawQueryWithFactory(SQLiteDatabase.java:1345)
08-01 14:48:35.474: ERROR/Cursor(328):     at android.database.sqlite.SQLiteDatabase.queryWithFactory(SQLiteDatabase.java:1229)
08-01 14:48:35.474: ERROR/Cursor(328):     at android.database.sqlite.SQLiteDatabase.query(SQLiteDatabase.java:1184)
08-01 14:48:35.474: ERROR/Cursor(328):     at android.database.sqlite.SQLiteDatabase.query(SQLiteDatabase.java:1264)
08-01 14:48:35.474: ERROR/Cursor(328):     at com.android.caigang.db.DataHelper.GetUserList(DataHelper.java:39)
08-01 14:48:35.474: ERROR/Cursor(328):     at com.android.caigang.view.AccountActivity$1.onReceive(AccountActivity.java:220)
08-01 14:48:35.474: ERROR/Cursor(328):     at android.app.ActivityThread$PackageInfo$ReceiverDispatcher$Args.run(ActivityThread.java:892)
08-01 14:48:35.474: ERROR/Cursor(328):     at android.os.Handler.handleCallback(Handler.java:587)
08-01 14:48:35.474: ERROR/Cursor(328):     at android.os.Handler.dispatchMessage(Handler.java:92)
08-01 14:48:35.474: ERROR/Cursor(328):     at android.os.Looper.loop(Looper.java:123)
08-01 14:48:35.474: ERROR/Cursor(328):     at android.app.ActivityThread.main(ActivityThread.java:4627)
08-01 14:48:35.474: ERROR/Cursor(328):     at java.lang.reflect.Method.invokeNative(Native Method)
08-01 14:48:35.474: ERROR/Cursor(328):     at java.lang.reflect.Method.invoke(Method.java:521)
08-01 14:48:35.474: ERROR/Cursor(328):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
08-01 14:48:35.474: ERROR/Cursor(328):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
08-01 14:48:35.474: ERROR/Cursor(328):     at dalvik.system.NativeStart.main(Native Method)
08-01 14:48:35.555: INFO/SSLSocketFactory(328): Using factory org.apache.harmony.xnet.provider.jsse.OpenSSLSocketFactoryImpl@4007ec10
08-01 14:48:35.584: DEBUG/NativeCrypto(328): Freeing OpenSSL session
08-01 14:48:36.024: WARN/HttpMethodBase(328): Going to buffer response body of large or unknown size. Using getResponseBodyAsStream instead is recommended.
08-01 14:48:36.034: DEBUG/MyWeiboSync(328): oauth_token=168a838ffae64cc190c08c5da6cdc150&oauth_token_secret=f5db9f5571ffc212ff21d8bc567b4b21&name=cheney_life
08-01 14:48:36.224: ERROR/HaveUserInfo(328): true
08-01 14:48:36.234: WARN/System.err(328): java.net.MalformedURLException
08-01 14:48:36.234: WARN/System.err(328):     at java.net.URL.<init>(URL.java:211)
08-01 14:48:36.245: WARN/System.err(328):     at java.net.URL.<init>(URL.java:159)
08-01 14:48:36.245: WARN/System.err(328):     at com.android.caigang.util.ImageUtil.getRequest(ImageUtil.java:29)
08-01 14:48:36.245: WARN/System.err(328):     at com.android.caigang.util.ImageUtil.getBytesFromUrl(ImageUtil.java:88)
08-01 14:48:36.245: WARN/System.err(328):     at com.android.caigang.util.ImageUtil.getRoundBitmapFromUrl(ImageUtil.java:76)
08-01 14:48:36.245: WARN/System.err(328):     at com.android.caigang.view.AccountActivity$1.onReceive(AccountActivity.java:206)
08-01 14:48:36.245: WARN/System.err(328):     at android.app.ActivityThread$PackageInfo$ReceiverDispatcher$Args.run(ActivityThread.java:892)
08-01 14:48:36.245: WARN/System.err(328):     at android.os.Handler.handleCallback(Handler.java:587)
08-01 14:48:36.245: WARN/System.err(328):     at android.os.Handler.dispatchMessage(Handler.java:92)
08-01 14:48:36.254: WARN/System.err(328):     at android.os.Looper.loop(Looper.java:123)
08-01 14:48:36.254: WARN/System.err(328):     at android.app.ActivityThread.main(ActivityThread.java:4627)
08-01 14:48:36.254: WARN/System.err(328):     at java.lang.reflect.Method.invokeNative(Native Method)
08-01 14:48:36.263: WARN/System.err(328):     at java.lang.reflect.Method.invoke(Method.java:521)
08-01 14:48:36.263: WARN/System.err(328):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
08-01 14:48:36.263: WARN/System.err(328):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
08-01 14:48:36.263: WARN/System.err(328):     at dalvik.system.NativeStart.main(Native Method)
08-01 14:48:36.263: ERROR/AccountActivity(328): {"data":{"birth_day":1,"birth_month":1,"birth_year":1987,"city_code":"1","country_code":"1","edu":null,"email":"","fansnum":20,"head":"","idolnum":2,"introduction":"","isent":0,"isvip":0,"location":"山东 济南","name":"cheney_life","nick":"漫步云端","province_code":"37","sex":1,"tag":null,"tweetnum":33,"verifyinfo":""},"errcode":0,"msg":"ok","ret":0}
08-01 14:48:36.263: ERROR/AccountActivity(328): 593848
08-01 14:50:05.904: DEBUG/SntpClient(59): request time failed: java.net.SocketException: Address family not supported by protocol

0 请登录后投票
   发表时间:2011-08-01   最后修改:2011-08-01
cheney_love 写道
LZ你好,我的报如下错误,从返回的json数据来看,应该是验证通过了,应该是数据库的地方有问题吧
08-01 14:48:34.654: WARN/System.err(328): java.lang.NullPointerException
08-01 14:48:34.679: WARN/System.err(328):     at java.io.ByteArrayInputStream.<init>(ByteArrayInputStream.java:62)
08-01 14:48:34.679: WARN/System.err(328):     at com.android.caigang.db.DataHelper.GetUserList(DataHelper.java:50)
08-01 14:48:34.684: WARN/System.err(328):     at com.android.caigang.view.AccountActivity$1.onReceive(AccountActivity.java:220)
08-01 14:48:34.684: WARN/System.err(328):     at android.app.ActivityThread$PackageInfo$ReceiverDispatcher$Args.run(ActivityThread.java:892)
08-01 14:48:34.701: WARN/System.err(328):     at android.os.Handler.handleCallback(Handler.java:587)
08-01 14:48:34.704: WARN/System.err(328):     at android.os.Handler.dispatchMessage(Handler.java:92)
08-01 14:48:34.704: WARN/System.err(328):     at android.os.Looper.loop(Looper.java:123)
08-01 14:48:34.704: WARN/System.err(328):     at android.app.ActivityThread.main(ActivityThread.java:4627)
08-01 14:48:34.704: WARN/System.err(328):     at java.lang.reflect.Method.invokeNative(Native Method)
08-01 14:48:34.704: WARN/System.err(328):     at java.lang.reflect.Method.invoke(Method.java:521)
08-01 14:48:34.704: WARN/System.err(328):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
08-01 14:48:34.714: WARN/System.err(328):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
08-01 14:48:34.714: WARN/System.err(328):     at dalvik.system.NativeStart.main(Native Method)
08-01 14:48:34.714: ERROR/AccountActivity(328): {"data":{"birth_day":1,"birth_month":1,"birth_year":1987,"city_code":"1","country_code":"1","edu":null,"email":"","fansnum":20,"head":"","idolnum":2,"introduction":"","isent":0,"isvip":0,"location":"山东 济南","name":"cheney_life","nick":"漫步云端","province_code":"37","sex":1,"tag":null,"tweetnum":33,"verifyinfo":""},"errcode":0,"msg":"ok","ret":0}
08-01 14:48:34.724: ERROR/AccountActivity(328): 593848
08-01 14:48:34.764: WARN/ActivityManager(59): Duplicate finish request for HistoryRecord{44fb7978 com.android.caigang/.view.AuthorizeActivity}
08-01 14:48:35.424: DEBUG/dalvikvm(328): GC_FOR_MALLOC freed 8509 objects / 470752 bytes in 92ms
08-01 14:48:35.474: ERROR/Cursor(328): Finalizing a Cursor that has not been deactivated or closed. database = /data/data/com.android.caigang/databases/weibo.db, table = users, query = SELECT * FROM users ORDER BY _id DESC
08-01 14:48:35.474: ERROR/Cursor(328): android.database.sqlite.DatabaseObjectNotClosedException: Application did not close the cursor or database object that was opened here
08-01 14:48:35.474: ERROR/Cursor(328):     at android.database.sqlite.SQLiteCursor.<init>(SQLiteCursor.java:210)
08-01 14:48:35.474: ERROR/Cursor(328):     at android.database.sqlite.SQLiteDirectCursorDriver.query(SQLiteDirectCursorDriver.java:53)
08-01 14:48:35.474: ERROR/Cursor(328):     at android.database.sqlite.SQLiteDatabase.rawQueryWithFactory(SQLiteDatabase.java:1345)
08-01 14:48:35.474: ERROR/Cursor(328):     at android.database.sqlite.SQLiteDatabase.queryWithFactory(SQLiteDatabase.java:1229)
08-01 14:48:35.474: ERROR/Cursor(328):     at android.database.sqlite.SQLiteDatabase.query(SQLiteDatabase.java:1184)
08-01 14:48:35.474: ERROR/Cursor(328):     at android.database.sqlite.SQLiteDatabase.query(SQLiteDatabase.java:1264)
08-01 14:48:35.474: ERROR/Cursor(328):     at com.android.caigang.db.DataHelper.GetUserList(DataHelper.java:39)
08-01 14:48:35.474: ERROR/Cursor(328):     at com.android.caigang.view.AccountActivity$1.onReceive(AccountActivity.java:220)
08-01 14:48:35.474: ERROR/Cursor(328):     at android.app.ActivityThread$PackageInfo$ReceiverDispatcher$Args.run(ActivityThread.java:892)
08-01 14:48:35.474: ERROR/Cursor(328):     at android.os.Handler.handleCallback(Handler.java:587)
08-01 14:48:35.474: ERROR/Cursor(328):     at android.os.Handler.dispatchMessage(Handler.java:92)
08-01 14:48:35.474: ERROR/Cursor(328):     at android.os.Looper.loop(Looper.java:123)
08-01 14:48:35.474: ERROR/Cursor(328):     at android.app.ActivityThread.main(ActivityThread.java:4627)
08-01 14:48:35.474: ERROR/Cursor(328):     at java.lang.reflect.Method.invokeNative(Native Method)
08-01 14:48:35.474: ERROR/Cursor(328):     at java.lang.reflect.Method.invoke(Method.java:521)
08-01 14:48:35.474: ERROR/Cursor(328):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
08-01 14:48:35.474: ERROR/Cursor(328):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
08-01 14:48:35.474: ERROR/Cursor(328):     at dalvik.system.NativeStart.main(Native Method)
08-01 14:48:35.555: INFO/SSLSocketFactory(328): Using factory org.apache.harmony.xnet.provider.jsse.OpenSSLSocketFactoryImpl@4007ec10
08-01 14:48:35.584: DEBUG/NativeCrypto(328): Freeing OpenSSL session
08-01 14:48:36.024: WARN/HttpMethodBase(328): Going to buffer response body of large or unknown size. Using getResponseBodyAsStream instead is recommended.
08-01 14:48:36.034: DEBUG/MyWeiboSync(328): oauth_token=168a838ffae64cc190c08c5da6cdc150&oauth_token_secret=f5db9f5571ffc212ff21d8bc567b4b21&name=cheney_life
08-01 14:48:36.224: ERROR/HaveUserInfo(328): true
08-01 14:48:36.234: WARN/System.err(328): java.net.MalformedURLException
08-01 14:48:36.234: WARN/System.err(328):     at java.net.URL.<init>(URL.java:211)
08-01 14:48:36.245: WARN/System.err(328):     at java.net.URL.<init>(URL.java:159)
08-01 14:48:36.245: WARN/System.err(328):     at com.android.caigang.util.ImageUtil.getRequest(ImageUtil.java:29)
08-01 14:48:36.245: WARN/System.err(328):     at com.android.caigang.util.ImageUtil.getBytesFromUrl(ImageUtil.java:88)
08-01 14:48:36.245: WARN/System.err(328):     at com.android.caigang.util.ImageUtil.getRoundBitmapFromUrl(ImageUtil.java:76)
08-01 14:48:36.245: WARN/System.err(328):     at com.android.caigang.view.AccountActivity$1.onReceive(AccountActivity.java:206)
08-01 14:48:36.245: WARN/System.err(328):     at android.app.ActivityThread$PackageInfo$ReceiverDispatcher$Args.run(ActivityThread.java:892)
08-01 14:48:36.245: WARN/System.err(328):     at android.os.Handler.handleCallback(Handler.java:587)
08-01 14:48:36.245: WARN/System.err(328):     at android.os.Handler.dispatchMessage(Handler.java:92)
08-01 14:48:36.254: WARN/System.err(328):     at android.os.Looper.loop(Looper.java:123)
08-01 14:48:36.254: WARN/System.err(328):     at android.app.ActivityThread.main(ActivityThread.java:4627)
08-01 14:48:36.254: WARN/System.err(328):     at java.lang.reflect.Method.invokeNative(Native Method)
08-01 14:48:36.263: WARN/System.err(328):     at java.lang.reflect.Method.invoke(Method.java:521)
08-01 14:48:36.263: WARN/System.err(328):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
08-01 14:48:36.263: WARN/System.err(328):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
08-01 14:48:36.263: WARN/System.err(328):     at dalvik.system.NativeStart.main(Native Method)
08-01 14:48:36.263: ERROR/AccountActivity(328): {"data":{"birth_day":1,"birth_month":1,"birth_year":1987,"city_code":"1","country_code":"1","edu":null,"email":"","fansnum":20,"head":"","idolnum":2,"introduction":"","isent":0,"isvip":0,"location":"山东 济南","name":"cheney_life","nick":"漫步云端","province_code":"37","sex":1,"tag":null,"tweetnum":33,"verifyinfo":""},"errcode":0,"msg":"ok","ret":0}
08-01 14:48:36.263: ERROR/AccountActivity(328): 593848
08-01 14:50:05.904: DEBUG/SntpClient(59): request time failed: java.net.SocketException: Address family not supported by protocol




根据报错信息,定位到这句,报空指针,应该是dataHelper报的空,你在报错的这一句的上面在加上下面这一句
试一试,dataHelper = DataBaseContext.getInstance(getApplicationContext());你刚才授权成功之后回来列表中没有数据就是这句造成的,这也怪我,没仔细测试啊(时间太紧了),
  • 大小: 4.9 KB
0 请登录后投票
   发表时间:2011-08-01  
感谢楼主分享,明天就开始学习你的源码
0 请登录后投票
   发表时间:2011-08-02  
非常不错的系列,有空仔细研究一下
0 请登录后投票
论坛首页 移动开发技术版

跳转论坛:
Global site tag (gtag.js) - Google Analytics