开发者

I want to make new List every login

I have an Android App that logins to a MySQL database and gets infomation from the database. Every ID has some messages sent to that ID, and I make them to be showed in ListView.

final ArrayAdapter<String> titleAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, titleArray);
final ListView lvInbox = (ListView)findViewById(R.id.lvInbox);
lvInbox.setAdapter(titleAdapter);

My Youtube Video Problem --> click to view and help me!

In that video, if I log in with username: 20081561 and I get 3 messages I click back and log in with other username: 20083152 and I get 4 messages Actually, the username 20083152 only have one messages and 3 others is 20081561's

If 开发者_运维知识库I build my app again and log in, it just shows only messages of the username logged in.

Can anyone help me?


you should try reinitializing your titleArray on every activity.onStart, or clearing it up on every logout.

also you could check in your androidManifest.xml that these attributes are set properly:

<activity android:name="YourActivity"
    [...]
    android:alwaysRetainTaskState="false"
    android:clearTaskOnLaunch="true" [...]>
    [...]
</activity>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜