انجمن سایت کلیدستان


رتبه موضوع:
  • 0 رای - 0 میانگین
  • 1
  • 2
  • 3
  • 4
  • 5
قراردادن راهنما دراندروید

قراردادن راهنما دراندروید

#1
سلام برای چطورمیشه برای برنامه ای که ساختیم راهنما قراردهیم که فقط بعداز نصب دراولین اجرای برنامه اجراشود و قسمت هایمختلف راتوضیح دهد
 
پاسخ

قراردادن راهنما دراندروید

#2
سلام

یه کد ساده برای نمایش دادن یه پبام و غیر فعال کردن اون.

checkbox.xml
کد پی‌اچ‌پی:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/layout_root"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="horizontal"
    android:padding="10dp" >
    <CheckBox
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/skip"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Ok please do not show again." >
    </CheckBox>
</LinearLayout> 
Activity.java
کد پی‌اچ‌پی:
public class SeActivity extends Activity {
    public static final 
String PREFS_NAME "MyPrefsFile1";
    public 
CheckBox dontShowAgain;

    
/** Called when the activity is first created. */
    
@Override
    
public void onCreate(Bundle savedInstanceState) {
        
super.onCreate(savedInstanceState);
        
setContentView(R.layout.main);
    }

    
/** Called when the activity is brought to front. */
    
@Override
    
protected void onResume() {
        
AlertDialog.Builder adb = new AlertDialog.Builder(this);
        
LayoutInflater adbInflater LayoutInflater.from(this);
        
View eulaLayout adbInflater.inflate(R.layout.checkboxnull);
        
dontShowAgain = (CheckBoxeulaLayout.findViewById(R.id.skip);
        
adb.setView(eulaLayout);
        
adb.setTitle("Attention");
        
adb.setMessage(Html.fromHtml("Zukky, how can I see this then?"));
        
adb.setPositiveButton("Ok", new DialogInterface.OnClickListener() {
            public 
void onClick(DialogInterface dialogint which) {
                
String checkBoxResult "NOT checked";
                if (
dontShowAgain.isChecked())
                    
checkBoxResult "checked";
                
SharedPreferences settings getSharedPreferences(PREFS_NAME0);
                
SharedPreferences.Editor editor settings.edit();
                
editor.putString("skipMessage"checkBoxResult);
                
// Commit the edits!
                
editor.commit();
                
startActivity(new Intent(Intent.ACTION_VIEWUri.parse("http://misha.beshkin.lv/android-alertdialog-with-checkbox/")));
                return;
            }
        });

        
adb.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
            public 
void onClick(DialogInterface dialogint which) {
                
String checkBoxResult "NOT checked";
                if (
dontShowAgain.isChecked())
                    
checkBoxResult "checked";
                
SharedPreferences settings getSharedPreferences(PREFS_NAME0);
                
SharedPreferences.Editor editor settings.edit();
                
editor.putString("skipMessage"checkBoxResult);
                
// Commit the edits!
                
editor.commit();
                return;
            }
        });
        
SharedPreferences settings getSharedPreferences(PREFS_NAME0);
        
String skipMessage settings.getString("skipMessage""NOT checked");
        if (!
skipMessage.equals("checked"))
            
adb.show();

        
super.onResume();
    }


شکل خروجی

   
 

منبع
پاسخ
 سپاس شده توسط admin ، isazadeh

قراردادن راهنما دراندروید

#3
سلام.
در مورد showCaseView نیز تحقیق کنید (البته بنده تاکنون از آن استفاده نکرده ام).
اگر تنها قصد دارید که یک پیام ساده مثل Dialog (کلید شماره 227) نمایش داده شود، از کلید زیر استفاده کنید که شرح می دهد چگونه یک سری کد را تنها یک بار اجرا کنید :

کلید شماره 250

bookbook 
لطفا برای درج کد، از دکمه مخصوص درج کد در ادیتور انجمن استفاده کنید.
در مورد برنامه نویسی، مدیران تنها راهنمایی می کنند و نوشتن برنامه نهایی، به عهده کاربران می باشد (اینجا محلی برای یادگیری است، نه سفارش کدنویسی).
کاربران باید ابتدا خود به خطایابی برنامه بپردازند، نه اینکه به محض دیدن خطا، کدها را در انجمن، copy و paste کرده و از مدیران انتظار بررسی داشته باشند.
پاسخ
 سپاس شده توسط alireza74 ، isazadeh ، mahdi2elve ، شماره مجازی امارات


پرش به انجمن:


کاربران در حال بازدید این موضوع: 1 مهمان