رفتن به مطلب

محمدرضا شاهپیری

مدیر کل سایت
  • تعداد ارسال ها

    4,058
  • تاریخ عضویت

  • آخرین بازدید

  • روز های برد

    772

پست ها ارسال شده توسط محمدرضا شاهپیری

  1. در ۱۴۰۳/۱/۳۱ در ۲۲:۲۸، berayan گفته است:

    سلام . موقع کامپایل به این کلاس ایراد میگیره 

    سلام و درود. شما باید کلاس PoolakeyWrapper رو ایجاد کنید مطابق راهنماییهای پست اول. اگه کلاس رو ایجاد کردید و هنوز خطا میده شاید از نسخه کاتلینتون باشه. کاتلین رو به نسخه آخر بروز کنید

  2. سلام و درود

    حتما آموزش کار با کتابخونه رو ببینید

    اول یه سرویس که باید بسازید برای اجرای آلارم به نام AlarmService و متد زیر رو اجرا کنید.

     

    Sub setAlarm
    	Dim prmodel As PersianAlarmModel
    	prmodel.initialize(AlarmService)
    	Dim prtime As PersianTimeUtils
    	prtime.initialize
    	Dim time As Long=prtime.GetTimeInMillis+15*60*1000
    	pralarm.setExact(prmodel,pralarm.AlarmManager_RTC_WAKEUP,pralarm.FLAG_UPDATE_CURRENT,1,pralarm.TimeUnit_MILLISECONDS,time)
    End Sub

     

    حالا تو سرویس به شکل زیر دوباره تنطیم کنید

    #Region  Service Attributes 
    	#StartAtBoot: False
    #End Region
    
    Sub Process_Globals
    
    End Sub
    
    Sub Service_Create
    
    End Sub
    
    Sub Service_Start (StartingIntent As Intent)
    ' اول 5 دقیقه رکورد کن
    ' حالا دوباره آلارم رو تنظیم کن
    setAlarm
    End Sub
    
    Sub Service_Destroy
    
    End Sub

     

    • پسندیدن 1
  3. ۱۸ ساعت قبل، salar_blackdroid گفته است:

    مگه برای Internal هم دسترسی لازمه ؟ مرسی که راهنمایی میکنید.

    خیر نیازی نیست. اشتباه شما توی خط زیره

    ToastMessageShow("OK","")

    ورودی دوم تابع ToastMessageShow بولین هست نه استرینگ. به شکل زیر میشه

    ToastMessageShow("OK",False)

     

    • پسندیدن 1
  4. ۱۱ ساعت قبل، امیرحسین قاسمی گفته است:

    لطفا تصویر زیر رو ببینید:

    image.png.7df368d08c6e0fdedbf267b168b79ffb.png

    اندازه متن از اندازه EditText بیشتره و این باعث شده که نصف متن داخل EditText نمایش داده نشه!

    الان توی دستگاهی با صفحه نمایش بزرگتر (مثلا تبلت ها) ممکنه مشکلی وجود نداشته باشه چون به مراتب EditText هم بزرگتر میشه و متن کامل نمایش داده میشه اما توی گوشی ها و صفحه نمایش های کوچیک چنین اتفاقی رخ میده.

    برای لیبل راه حل وجود داره که توی همه دستگاه ها متن داخلش فیت بشه اما برای ادیت تکست چیزی پیدا نکردم!

    روش زیر رو استفاده کنید. تا حد خیلی زیادی مشکل رو حل میکنه.

    اول فایل زیپ رو دانلود و تو مسیر پروژه اکسترکت کنید

    و توی Region  Project Attributes کد زیر رو اضافه کنید

    #AdditionalRes: ..\res

    حالا کدهای زیر رو اضافه کنید به اکتیویتی

    
    #If java
    import android.util.TypedValue;
    import android.widget.TextView;
    import java.lang.reflect.Field;
    private int getResId(String variableName) {
        Field field;
        int resId = 0;
        try {
            field = R.dimen.class.getField(variableName);
            try {
                field.setAccessible(true);
                resId = field.getInt(null);
            } catch (Exception e) {
                e.printStackTrace();
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        return resId;
    }
    public void setTextSize(TextView txt , int textSize){
        try {
            int resourceID =getResId("_"+textSize+"ssp");
            txt.setTextSize(TypedValue.COMPLEX_UNIT_PX, getResources().getDimension(resourceID));
        }catch (Exception e) {
            e.printStackTrace();
        }
    }
    public float getDpSize(int textSize) {
    	try {
    	    int resourceID = getResId("_" + textSize + "sdp");
    	    return getResources().getDimension(resourceID);
    	} catch (Exception e) {
    	    e.printStackTrace();
    	}
    	return 0;
    }
    #End If

    به شکل زیر استفاده کنید

    Dim jo As JavaObject:jo.InitializeContext
    	jo.RunMethod("setTextSize",Array(EditText1,15))
    	Dim size100Dp As Int=jo.RunMethod("getDpSize",Array(100))
    	Button2.Width=size100Dp
    	Button2.Height=size100Dp

     

    • پسندیدن 1
  5. ۹ ساعت قبل، امیرحسین قاسمی گفته است:

    سلام،

    برای اینکه سایز متن داخل ادیت تکست با ارتفاع ادیت تکست هماهنگ بشه به طوری که بیرون نزنه چه راه استانداردی هست؟

    EditText1.TextSize=40

    الان ممکنه توی تبلت ها متن داخل ادیت تکست فیت باشه اما توی گوشی ها از بالا و پایین بیرون بزنه!

    سلام منظورتون اینه موقه تایپ و اینتر زدن ارتفاع زیاد بشه؟

  6. ۱۰ ساعت قبل، DexterFstone گفته است:

    استاد شرمنده گفتم تاپیک جدید نزنم چون حالا ارور جدید دریافت کردم ممنون میشم راهنمایی فرمایید

    > Task :app:mergeDebugAndroidTestJavaResource FAILED
    
    FAILURE: Build completed with 3 failures.
    
    1: Task failed with an exception.
    -----------
    * What went wrong:
    Execution failed for task ':app:processDebugManifest'.
    > A failure occurred while executing com.android.build.gradle.tasks.ProcessLibraryManifest$ProcessLibWorkAction
       > Manifest merger failed with multiple errors, see logs
    
    * Try:
    > Run with --stacktrace option to get the stack trace.
    > Run with --info or --debug option to get more log output.
    > Run with --scan to get full insights.
    > Get more help at https://help.gradle.org.
    ==============================================================================
    
    2: Task failed with an exception.
    -----------
    * What went wrong:
    Execution failed for task ':app:checkDebugAndroidTestDuplicateClasses'.
    > A failure occurred while executing com.android.build.gradle.internal.tasks.CheckDuplicatesRunnable
       > Duplicate class android.support.v4.app.INotificationSideChannel found in modules core-1.9.0-runtime (androidx.core:core:1.9.0) and support-compat-28.0.0-runtime (com.android.support:support-compat:28.0.0)
         Duplicate class android.support.v4.app.INotificationSideChannel$Stub found in modules core-1.9.0-runtime (androidx.core:core:1.9.0) and support-compat-28.0.0-runtime (com.android.support:support-compat:28.0.0)
         Duplicate class android.support.v4.app.INotificationSideChannel$Stub$Proxy found in modules core-1.9.0-runtime (androidx.core:core:1.9.0) and support-compat-28.0.0-runtime (com.android.support:support-compat:28.0.0)
         Duplicate class android.support.v4.graphics.drawable.IconCompatParcelizer found in modules core-1.9.0-runtime (androidx.core:core:1.9.0) and support-compat-28.0.0-runtime (com.android.support:support-compat:28.0.0)
         Duplicate class android.support.v4.os.IResultReceiver found in modules core-1.9.0-runtime (androidx.core:core:1.9.0) and support-compat-28.0.0-runtime (com.android.support:support-compat:28.0.0)
         Duplicate class android.support.v4.os.IResultReceiver$Stub found in modules core-1.9.0-runtime (androidx.core:core:1.9.0) and support-compat-28.0.0-runtime (com.android.support:support-compat:28.0.0)
         Duplicate class android.support.v4.os.IResultReceiver$Stub$Proxy found in modules core-1.9.0-runtime (androidx.core:core:1.9.0) and support-compat-28.0.0-runtime (com.android.support:support-compat:28.0.0)
         Duplicate class android.support.v4.os.ResultReceiver found in modules core-1.9.0-runtime (androidx.core:core:1.9.0) and support-compat-28.0.0-runtime (com.android.support:support-compat:28.0.0)
         Duplicate class android.support.v4.os.ResultReceiver$1 found in modules core-1.9.0-runtime (androidx.core:core:1.9.0) and support-compat-28.0.0-runtime (com.android.support:support-compat:28.0.0)
         Duplicate class android.support.v4.os.ResultReceiver$MyResultReceiver found in modules core-1.9.0-runtime (androidx.core:core:1.9.0) and support-compat-28.0.0-runtime (com.android.support:support-compat:28.0.0)
         Duplicate class android.support.v4.os.ResultReceiver$MyRunnable found in modules core-1.9.0-runtime (androidx.core:core:1.9.0) and support-compat-28.0.0-runtime (com.android.support:support-compat:28.0.0)
         Duplicate class androidx.core.graphics.drawable.IconCompatParcelizer found in modules core-1.9.0-runtime (androidx.core:core:1.9.0) and support-compat-28.0.0-runtime (com.android.support:support-compat:28.0.0)
         Duplicate class androidx.core.internal.package-info found in modules core-1.9.0-runtime (androidx.core:core:1.9.0) and support-compat-28.0.0-runtime (com.android.support:support-compat:28.0.0)
         Duplicate class androidx.versionedparcelable.CustomVersionedParcelable found in modules versionedparcelable-1.1.1-runtime (androidx.versionedparcelable:versionedparcelable:1.1.1) and versionedparcelable-28.0.0-runtime (com.android.support:versionedparcelable:28.0.0)
         Duplicate class androidx.versionedparcelable.NonParcelField found in modules versionedparcelable-1.1.1-runtime (androidx.versionedparcelable:versionedparcelable:1.1.1) and versionedparcelable-28.0.0-runtime (com.android.support:versionedparcelable:28.0.0)
         Duplicate class androidx.versionedparcelable.ParcelField found in modules versionedparcelable-1.1.1-runtime (androidx.versionedparcelable:versionedparcelable:1.1.1) and versionedparcelable-28.0.0-runtime (com.android.support:versionedparcelable:28.0.0)
         Duplicate class androidx.versionedparcelable.ParcelImpl found in modules versionedparcelable-1.1.1-runtime (androidx.versionedparcelable:versionedparcelable:1.1.1) and versionedparcelable-28.0.0-runtime (com.android.support:versionedparcelable:28.0.0)
         Duplicate class androidx.versionedparcelable.ParcelImpl$1 found in modules versionedparcelable-1.1.1-runtime (androidx.versionedparcelable:versionedparcelable:1.1.1) and versionedparcelable-28.0.0-runtime (com.android.support:versionedparcelable:28.0.0)
         Duplicate class androidx.versionedparcelable.ParcelUtils found in modules versionedparcelable-1.1.1-runtime (androidx.versionedparcelable:versionedparcelable:1.1.1) and versionedparcelable-28.0.0-runtime (com.android.support:versionedparcelable:28.0.0)
         Duplicate class androidx.versionedparcelable.VersionedParcel found in modules versionedparcelable-1.1.1-runtime (androidx.versionedparcelable:versionedparcelable:1.1.1) and versionedparcelable-28.0.0-runtime (com.android.support:versionedparcelable:28.0.0)
         Duplicate class androidx.versionedparcelable.VersionedParcel$1 found in modules versionedparcelable-1.1.1-runtime (androidx.versionedparcelable:versionedparcelable:1.1.1) and versionedparcelable-28.0.0-runtime (com.android.support:versionedparcelable:28.0.0)
         Duplicate class androidx.versionedparcelable.VersionedParcel$ParcelException found in modules versionedparcelable-1.1.1-runtime (androidx.versionedparcelable:versionedparcelable:1.1.1) and versionedparcelable-28.0.0-runtime (com.android.support:versionedparcelable:28.0.0)
         Duplicate class androidx.versionedparcelable.VersionedParcelParcel found in modules versionedparcelable-1.1.1-runtime (androidx.versionedparcelable:versionedparcelable:1.1.1) and versionedparcelable-28.0.0-runtime (com.android.support:versionedparcelable:28.0.0)
         Duplicate class androidx.versionedparcelable.VersionedParcelStream found in modules versionedparcelable-1.1.1-runtime (androidx.versionedparcelable:versionedparcelable:1.1.1) and versionedparcelable-28.0.0-runtime (com.android.support:versionedparcelable:28.0.0)
         Duplicate class androidx.versionedparcelable.VersionedParcelStream$FieldBuffer found in modules versionedparcelable-1.1.1-runtime (androidx.versionedparcelable:versionedparcelable:1.1.1) and versionedparcelable-28.0.0-runtime (com.android.support:versionedparcelable:28.0.0)
         Duplicate class androidx.versionedparcelable.VersionedParcelable found in modules versionedparcelable-1.1.1-runtime (androidx.versionedparcelable:versionedparcelable:1.1.1) and versionedparcelable-28.0.0-runtime (com.android.support:versionedparcelable:28.0.0)
         Duplicate class androidx.versionedparcelable.VersionedParcelize found in modules versionedparcelable-1.1.1-runtime (androidx.versionedparcelable:versionedparcelable:1.1.1) and versionedparcelable-28.0.0-runtime (com.android.support:versionedparcelable:28.0.0)
         
         Go to the documentation to learn how to <a href="d.android.com/r/tools/classpath-sync-errors">Fix dependency resolution errors</a>.
    
    * Try:
    > Run with --stacktrace option to get the stack trace.
    > Run with --info or --debug option to get more log output.
    > Run with --scan to get full insights.
    > Get more help at https://help.gradle.org.
    ==============================================================================
    
    3: Task failed with an exception.
    -----------
    * What went wrong:
    Execution failed for task ':app:mergeDebugAndroidTestJavaResource'.
    > A failure occurred while executing com.android.build.gradle.internal.tasks.MergeJavaResWorkAction
       > 2 files found with path 'META-INF/androidx.localbroadcastmanager_localbroadcastmanager.version' from inputs:
          - C:\Users\Dexter\.gradle\caches\transforms-3\2e49548e557ad3d981e0f53424b0c757\transformed\localbroadcastmanager-1.0.0\jars\classes.jar
          - C:\Users\Dexter\.gradle\caches\transforms-3\a15cc399ddde63742fc17939ec2289a5\transformed\localbroadcastmanager-28.0.0\jars\classes.jar
         Adding a packagingOptions block may help, please refer to
         https://developer.android.com/reference/tools/gradle-api/8.2/com/android/build/api/dsl/ResourcesPackagingOptions
         for more information
    
    * Try:
    > Run with --stacktrace option to get the stack trace.
    > Run with --info or --debug option to get more log output.
    > Run with --scan to get full insights.
    > Get more help at https://help.gradle.org.
    ==============================================================================
    
    BUILD FAILED in 8s
    34 actionable tasks: 7 executed, 27 up-to-date
    

    تنها چیزی ک اضافه کردم ب پروژه این مورد بوده

    implementation 'com.push-pole.android:pushpolesdk:1.7.8'

    قبل از اون چنین خطایی نداشتم

    همه کتابخونه ها رو به جز پوشه حذف کنید و دونه دونه اضافه کنید ببینید با کدوم تداخل داره

  7. درود

    اول از منوی file گزینه invalidate caches رو بزنید و تمام تیکهاشو فعال کنید

    بعد به این مسیر برید C:\Users\username\.gradle و پوشه caches رو پاک کنید

    یه کم حجم دانلود زیاد میشه اما احتمالا درست میشه و دقت کنید که اینترنت استیبل باشه و قطع و وصل نشه

    • پسندیدن 1
  8. درود و احترام. ممنون بابت ایجاد تاپیک

    امسال به نسبت سال قبل خب در کل بهتر بود. اون مصیبتهای پارسال توی اعتراضات رو خداروشکر به اون صورت نداشتیم و از این لحاظ اعصابمون آرومتر بود.

    من امسال خیلی چیزای جدید یاد گرفتم خداروشکر. هم توی اندروید و هم تو زمینه های دیگه. یه سری کارای شخصی هم داشتم که اعصاب خورد کن بود و به لطف خداوند اونا هم تموم شد.

    سایت شخصی خودمو راه اندازی کردم همینطور لینکدین و گیتهابمو تقویت کردم و تونستم رزومه شغلیمو تا حد زیادی ارتقا بدم.

    امیدوارم سال جدید بهتر از سالهای گذشته باشه و امید به اینده این مملکت رو تو دل همه ماها بیشتر کنه.:doa:

    سال نوی همه‌ی ایرانیا به خصوص انسرسنتریهای عزیز پیشاپیش مبارک باشه ♥

    • پسندیدن 3
  9. درود

    این خطا زمانی اتفاق می افته که از کدهای c++ توی برنامه استفاده شده و برای پردازنده اون گوشی که اپ روش میخواد نصب بشه کامپایل نشده.

    باید فایل apk رو باز کنید تو پوشه libs رو نگاه کنید ببینید چه پردازنده ای کامپایل نشده

    • پسندیدن 2
  10. در ۱۴۰۲/۱۲/۷ در ۱۵:۲۴، batman۱۲۳ گفته است:

    بعد استاد ببخشید توی همه اندرویدها این خط مسیر امن هست و فورس کلوز نمیده؟!

    و انجام میشه؟

    runtime.GetSafeDirDefaultExternal(Null)

     

    بله این مسیر مسیر safe  مربوط به هر برنامه روی حافظه داخلی هست و دسترسی نیاز نداره

    • ذوق زده 1
  11. در ۱۴۰۲/۱۲/۴ در 01:16، batman123 گفته است:

    سلام استاد

    مثلا این سورس:

    https://biaupload.com/do.php?filename=org-71945f309aff1.rar

    کاستوم لیست ویوی زیر منو کار نمیکنه

    پیاده سازیتون کلا اشتباه بوده دوست عزیز. همه چیز رو باید از طریق خود NavigationDrawer لود کنید نه activity. 

    سورس رو ویرایش کردم

     

    navi.zip

    • ذوق زده 1
  12. ۲ ساعت قبل، امیرحسین قاسمی گفته است:

    بسیار خب ممنونم از راهنماییتون. الان درست شد و glide_onResourceReady فراخوانی شد.

    اما اگه چندتا ImageView داشتیم چیکار کنیم؟

    For i= 0 To 9
    	Dim img As ImageView
    	img.Initialize("o")
    	Activity.AddView(img,40%x,i*10%y,10%x,10%y)
    
    	glide.With("glide").asBitmap.load("https://www.w3schools.com/w3css/img_lights.jpg").intoTarget
    Next

    وقتی ساب glide_onResourceReady صدا زده شد ما نمیدونیم که این تصویر (resource) برای کدوم ImageView هست!

    شما متد onResourceReady رو کلا برای چی میخواین؟ با همون دستور .into(img) عکس توی imageview لود میشه

  13. ۵ ساعت قبل، امیرحسین قاسمی گفته است:

    اینبار ساب glide_onResourceReady همون دفعه اولم صدا زده نشد:

    Sub Globals
    	Dim glide As PersianGlide
    	Dim img As ImageView
    End Sub
    
    Sub Activity_Create(FirstTime As Boolean)
    	img.Initialize("o")
    	Activity.AddView(img,30%x,40%x,40%x,40%y)
    	glide.With("glide").asBitmap.load("https://www.w3schools.com/w3css/img_lights.jpg").into(img)
    End Sub
    
    Sub glide_onResourceReady(resource As Object)
    	Log("onResourceReady")
    End Sub

     

    باید دستور intoTarget رو بزنید نه into(img)

    • پسندیدن 1
×
×
  • اضافه کردن...