إسأل مهندس الحاسوب الآن
المهندس معتز محمد
مهندس الحاسوب
الأسئلة المجابة 29441 | نسبة الرضا 98.6%
اختصاصي حاسوب
كيف بقدر اعمل تطوير على تطبيق الدخول بكلمة مرور و...
كيف بقدر اعمل تطوير على تطبيق الدخول بكلمة مرور و اسم الستخدم بحيث يسمح لاعادة المحاولة ثلاث مرات وعند المحاولى الرابعة يعمل على جعل مربع النص و مربع كلمة المرور و زر الامر خافتة لا تعمل ( كيف اعمل اللبنات )
مساعدة الخبير: ما هي البرامج والإصدارات التي تستخدمها؟
اب انفنتر و الجهاز نوعو اندرويد
مساعدة الخبير: هل لديك أي معلومة أخرى تريد أن تطلع مهندس الحاسوب عليها قبل أن أقوم بإيصالك به؟
لا
إطرح سؤالك
إجابة الخبير: المهندس معتز محمد
المهندس معتز محمد
مهندس الحاسوب
الأسئلة المجابة 29441 | نسبة الرضا 98.6%
طريقة كتابة كود برمجي لشاشة اسم المستخدم وكلمة المرور لتطبيق بلغة الاندرويد
public class Login extends ActionBarActivity implements OnClickListener { private static final String NAMESPACE = "***"; private static final String URL = "***"; private static final String METHOD_NAME = "login"; private static final String SOAP_ACTION = NAMESPACE + "/" + METHOD_NAME; //in wsdl it's nothing EditText usersusername, userspassword; Button LB; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_login); LB = (Button) findViewById(R.id.loginbutton); LB.setOnClickListener(this); usersusername = (EditText)findViewById(R.id.editusername); userspassword = (EditText)findViewById(R.id.editpassword); } public void onClick(View view){ if(usersusername.getText().length()==0) { usersusername.setError("Please enter your username"); } if(userspassword.getText().length()==0) { userspassword.setError("Please enter your password"); } switch (view.getId()){ case R.id.loginbutton: new LongOperation().execute(""); break; } } private class LongOperation extends AsyncTask<String, Void, String>{ @Override protected String doInBackground(String... params) { SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME); usersusername = (EditText)findViewById(R.id.editusername); userspassword = (EditText)findViewById(R.id.editpassword); String user_Name = usersusername.getText().toString(); String user_Password = userspassword.getText().toString(); PropertyInfo unameProp =new PropertyInfo(); unameProp.setName("userName");//Define the variable name in the web service method unameProp.setValue(user_Name);//set value for userName variable unameProp.setType(String.class);//Define the type of the variable request.addProperty("username",user_Name);//Pass properties to the variable //Using this to add parameters "username" grabbed from WSDL PropertyInfo passwordProp =new PropertyInfo(); passwordProp.setName("password"); passwordProp.setValue(user_Password); passwordProp.setType(String.class); request.addProperty(passwordProp); SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); // Declare the version of the soap request envelope.setOutputSoapObject(request); try { HttpTransportSE aht = new HttpTransportSE(URL); aht.call(SOAP_ACTION, envelope); SoapPrimitive result =(SoapPrimitive)envelope.getResponse(); // the result will be a session ID String sessionid = result.toString(); // convert the session ID to a string so we can check if we got something or not //System.out.println( Something); if (sessionid != null ) { Intent intent = new Intent(Login.this,Dashboard.class); intent.putExtra("username",usersusername.getText().toString()); startActivity(intent); } else { Intent intent = new Intent(Login.this,Login.class); startActivity(intent); } } catch (Exception e){ e.printStackTrace(); } return null; } // closing bracket of do in background } // closing bracket of long operationإسأل مهندس الحاسوب
المهندس معتز محمد
مهندس الحاسوب
الأسئلة المجابة 29441 | نسبة الرضا 98.6%
- 100% ضمان الرضا
- انضم الى 8 مليون من العملاء الراضين
المحادثات تتم ضمن هذه البنود