[Solved] How to check android application permissions on runtime using ContextCompat.checkSelfPermission()?

Please follow this tutorials Here is complete source code static final int PERMISSION_ALL = 1; String[] PERMISSIONS = {Manifest.permission.ACCESS_COARSE_LOCATION, Manifest.permission.ACCESS_FINE_LOCATION}; protected void runtimePermission() { if (!hasPermission(ContactUS.this, PERMISSIONS)) { ActivityCompat.requestPermissions(this, PERMISSIONS, PERMISSION_ALL); } } public static boolean hasPermission(Context context, String… permissions) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && context != null && permissions != null) { for … Read more

[Solved] How do I display a Toast in a setOnClickListener?

You have to override the onClick function. play_a.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Toast.makeText(getApplicationContext(),”Sorry, Play doesn’t work”, Toast.LENGTH_LONG).show(); } }); solved How do I display a Toast in a setOnClickListener?

[Solved] Android : I want to create loader with flight image

Without Plane in your Image I prefer to use ProgressBar but I will Be More Easy to user SeekBar As Progress Bar so let`s make it in Simplest way in Layout XML <?xml version=”1.0″ encoding=”utf-8″?> <LinearLayout xmlns:android=”http://schemas.android.com/apk/res/android” android:hardwareAccelerated=”false” android:orientation=”vertical” android:layout_width=”match_parent” android:layout_height=”match_parent”> <SeekBar android:paddingTop=”10dp” android:paddingBottom=”10dp” android:background=”#32aaef” android:id=”@+id/sbHeight” android:layout_width=”match_parent” android:layout_height=”wrap_content” android:layout_marginTop=”30dp” android:max=”100″ android:progress=”0″ android:progressDrawable=”@drawable/seekbar_as_progress” android:thumb=”@drawable/plane” /> </LinearLayout> … Read more

[Solved] Why do I have to use getSupportActionBar() for activity that extends AppCompatActivity?

AppCompatActivity is activity for older version android up to latest version. so if your targer application is android 2.3 – 6.0 you must extend appcompactactivity rather than just plain activity. and method getActionBar is intended to use with activity. getSupportActionBar is intended to use with appCompactActivity What you import is a class from other project, … Read more

[Solved] How to use shared preference to send data from activity to fragment?

If you insist on shared preference use this code : To save the data private void saveSp(String key , String value){ PreferenceManager.getDefaultSharedPreferences(Context) .edit() .putString(key, value).apply(); } To get your data: PreferenceManager.getDefaultSharedPreferences(Context).getString(“string”, “default”) solved How to use shared preference to send data from activity to fragment?

[Solved] I guess I found a typo on android documentation [closed]

The correct link to the docs is https://developer.android.com/reference/android/telephony/CellInfoNr The way to get docs corrected is to report the error to the author, not by posting a question on StackOverflow. The link for doc errors is https://issuetracker.google.com/issues/new?component=192697 1 solved I guess I found a typo on android documentation [closed]

[Solved] my navigation bar when I include it appears above [closed]

Can you try to use merge in this case? <?xml version=”1.0″ encoding=”utf-8″?> <merge xmlns:android=”http://schemas.android.com/apk/res/android” xmlns:app=”http://schemas.android.com/apk/res-auto” xmlns:tools=”http://schemas.android.com/tools” tools:parentTag=”androidx.constraintlayout.widget.ConstraintLayout”> //Your Bottom view </merge> Also in your BottomView add this app:layout_constraintEnd_toEndOf=”parent” so it will stay to the bottom 6 solved my navigation bar when I include it appears above [closed]

[Solved] Create Toast by a static method

Use this: public static void showToast(Context context, String text) { Toast.makeText(context, text, Toast.LENGTH_LONG).show(); } now for calling this method you should call like this: ClassName.showToast(context,”text”); Here classname is class that containing static method. 0 solved Create Toast by a static method