English 中文(简体)
关于和海底,我如何着手创造出一个信号,要求用户在完全发射数据之前进入用户名?
原标题:On android how would I go about creating a prompt for an app that requires a user to enter a username before fully launching the app?

我说,这是在安康工作时,我确实是新老。

因此,我必须努力开发现有仪器,并制作一个屏幕,使用户在进入时能够使用一个用户名称,然后才能启动目前的主要活动(即,它赢得了完全发射器的信号)。 相反,在用户名输入之前,它会坐在这个屏幕上。

我相信,这等于一个网站的标识页,即如果用户不作认证和授权,它不会让用户接过这一页。 然而,本表没有认证或授权。 相反,首先,用户必须只登记用户名,用户名可以保存到数据库,而对于随后的任何操作来说,由于用户已经登记到该电话,因此评估的主要活动将只是开始。 事实上,除非用所有数据删除该信并重新插入,否则该信不会促使用户重新使用其名称。

这意味着,我不得不在数据库或其他某种储存中节省用户名称。

因此,我想知道,在评估现有主要活动时,这样做的最佳方式是什么?

我是否应当努力完成这一现有主要活动,或开展新的活动,展示这一迅速的屏幕,实际上阻止主要活动从运行到用户进入其名称?

任何辅导或联系都是有益的,并事先感谢你提供任何帮助。

最佳回答

Create a login activity for user name and password.. If the user is new user.. registering for first time... then get the entered values and store them using shared preferences and open the activity..like this..

 SharedPreferences pref = context.getSharedPreferences("PREF_NAME", Context.MODE_PRIVATE);


pref.edit().putString("USERNAME", "PASSWORD").commit();<--Here use real username and password..


 pref.edit().clear().commit();
 Intent i=new Intent(this,youractivity.class);
startActivity(i);

其他

让用户进入用户名和密码领域,然后以共同的偏好对其进行检查。

   SharedPreferences pref = context.getSharedPreferences("PREF_NAME", Context.MODE_PRIVATE);
    String pswrd= pref.getString("Username", "somevalue");<--use entered username

if pswrd matches the entered password.. start the main activity..

  if(pswrd==entered password){
 Intent i=new Intent(this,youractivity.class);
startActivity(i);
  }

希望是明确的。

问题回答

您的主要活动(家庭意图)是要求获得证书(用户名称等)的方言活动。 然后,当用户报界(或你想要打上你的子孙)提交时,你就开始自己的“主要”活动,即在标识屏幕后开展第一项活动。

在启动日志屏幕时,检查用户是否已经入住。 如果是的话,立即开始“主要”活动,绕过原木。

也许与黑帮的回答一样——我这样做:

<>Main Activities oncreate:

if (!prefs.contains("username")) {
    startActivity(new Intent(this, Login.class));
    finish();
}

Login class when login finished and "username" saved restart Main Activity:

finish();
startActivity(new Intent(getApplicationContext(), Main.class));

非常简单,但表现得很好。





相关问题
Android - ListView fling gesture triggers context menu

I m relatively new to Android development. I m developing an app with a ListView. I ve followed the info in #1338475 and have my app recognizing the fling gesture, but after the gesture is complete, ...

AsyncTask and error handling on Android

I m converting my code from using Handler to AsyncTask. The latter is great at what it does - asynchronous updates and handling of results in the main UI thread. What s unclear to me is how to handle ...

Android intent filter for a particular file extension?

I want to be able to download a file with a particular extension from the net, and have it passed to my application to deal with it, but I haven t been able to figure out the intent filter. The ...

Android & Web: What is the equivalent style for the web?

I am quite impressed by the workflow I follow when developing Android applications: Define a layout in an xml file and then write all the code in a code-behind style. Is there an equivalent style for ...

TiledLayer equivalent in Android [duplicate]

To draw landscapes, backgrounds with patterns etc, we used TiledLayer in J2ME. Is there an android counterpart for that. Does android provide an option to set such tiled patterns in the layout XML?

Using Repo with Msysgit

When following the Android Open Source Project instructions on installing repo for use with Git, after running the repo init command, I run into this error: /c/Users/Andrew Rabon/bin/repo: line ...

Android "single top" launch mode and onNewIntent method

I read in the Android documentation that by setting my Activity s launchMode property to singleTop OR by adding the FLAG_ACTIVITY_SINGLE_TOP flag to my Intent, that calling startActivity(intent) would ...

From Web Development to Android Development

I have pretty good skills in PHP , Mysql and Javascript for a junior developer. If I wanted to try my hand as Android Development do you think I might find it tough ? Also what new languages would I ...

热门标签