开发者

How do i make dialog that pops up on second Run and after that

Basically i want a dialog which has text and 3 buttons

|| YES || NO || NEVER ||

I want it to pop up, only on second run and after that on every run until yes or never is selected.

I am sorry if this is a noobish question but i开发者_StackOverflow中文版 have no idea how to store data. Is shared preferences the way to go, if so can any one give me an idea as to which function is to be called and from where.

I am having trouble understanding this part, if i write the data from the activity, it'll basically be over written every time the app runs.


SharedPreferences is the way to go. Take a look at this example.


What is your real question? If I am not wrong, you asking this question :

  • how to store data
  • how to show 2 button instead 3 button after some point.

So the answer is, you can store your data on SharedPreferences use it like this

SharedPreferences sp = act.getSharedPreferences(name, MODE_PRIVATE);
Editor editor = sp.edit();
editor.putString(key, value); // put some data
editor.commit();

String val = sp.getString(key, defaultValue); // get some data, if it not exist, defaultValue will be returned
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜