286 views

Call requires permission which may be rejected by user

Call requires permission which may be rejected by user: code should explicitly check to see if permission is available (with `checkPermission`) or explicitly handle a potential `SecurityException`

 
try {
// your code for example: 
//  LocationManager locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);         
//  Criteria criteria = new Criteria();
//        provider = locationManager.getBestProvider(criteria, false);
//  locationManager.requestLocationUpdates(provider, 400, 1, this);
        } catch (SecurityException e) {
            e.printStackTrace();
        }
Posted in Android Examples Code, Bugs, warnings, errors | Tagged | Comments Off on Call requires permission which may be rejected by user
267 views

Error type 3 Activity class does not exist

Try some solution – each individually or all

  1. Check AndroidManifest.xml activity declaration
    <activity
                android:name=".EnableProfileActivity"
                android:label="@string/app_name" />
  2. Delete BUILD folder in module tree and Clean / Rebuild project
  3. Restart Android Studio
Posted in Bugs, warnings, errors | Tagged , | Comments Off on Error type 3 Activity class does not exist
418 views

Android Studio Gradle Download Link

I You use offline work for better building speed of project or for other purpose
https://gradle.org/releases

Offline work:
File – Settings – Gradle
– select Use local gradle distribution
– select path Gradle home:
– check Offline work

Posted in Android Studio | Tagged | Comments Off on Android Studio Gradle Download Link
460 views

EditText.setOnKeyListener not working on maxLines EditText

Check this in XML file if use singleLine
singleLine change to maxLines (1 if singleLine)
declare inputType

        android:maxLines="1"
        android:inputType="text"
Posted in Android Examples Code, Bugs, warnings, errors | Tagged , , | Comments Off on EditText.setOnKeyListener not working on maxLines EditText
458 views

ArrayList Sublist Join Compare Loop Synchronize HashMap Sort Tree

Link to tutorial

ArrayList Sublist of ArrayList Join two ArrayList Compare ArrayList Initialize ArrayList Loop ArrayList Sort ArrayList Array to ArrayList ArrayList to Array Synchronize ArrayList Serialize ArrayList LinkedList Loop LinkedList Vector ArrayList vs Vector ArrayList vs LinkedList HashMap Loop HashMap Synchronize HashMap Sort HashMap Serialize HashMap ArrayList vs HashMap TreeMap LinkedHashMap HashSet TreeSet LinkedHashSet ArrayList Methods

Posted in Android Examples Code | Tagged , , , , | Comments Off on ArrayList Sublist Join Compare Loop Synchronize HashMap Sort Tree
440 views

EditText hint not show

Try this solution – into xml file add row to EditText tag:

android:textColorHint="@color/grey"
Posted in Android Examples Code, Bugs, warnings, errors | Tagged , , | Comments Off on EditText hint not show
502 views

Convert Activity to Fragment Step by Step

public class Main extends Activity {
 
private TextView mTextView;
private Activity mAct;
private Intent mIntent;
 
protected void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  setContentView(R.layout.main_layout);
  mTextView = findViewById(R.id.mTextView);
  mAct = getActivity();
  mIntent = getIntent();
 }
 
}

to:

public class Main extends Fragment{
 
 private TextView mTextView;
 private FragmentActivity mFrgAct;
 private Intent mIntent;
 private LinearLayout mLinearLayout;
 public View onCreateView(LayoutInflater inflater, ViewGroup container,
          Bundle savedInstanceState) {
          View root = inflater.inflate(R.layout.fragment_main, null);
        return root;
    }
 
 public void onViewCreated(View view, Bundle savedInstanceState) {
          // you can add listener of elements here
          /*Button mButton = (Button) view.findViewById(R.id.button);
            mButton.setOnClickListener(this); */
          mTextView = view.findViewById(R.id.mTextView);
          mLinearLayout = (LinearLayout)view;
 }
 public void onActivityCreated(Bundle savedInstanceState) {
        super.onActivityCreated(savedInstanceState);
          mFrgAct = getActivity();
          mIntent = mFrgAct.getIntent(); //  Intent intent = new Intent(getActivity().getIntent());
 }
 
}
Posted in Android Examples Code, Fragments Tutorial | Tagged | Comments Off on Convert Activity to Fragment Step by Step
432 views

Android Fragment Examples

Code look up at the Api Demos

android_fragments arguments attributes – three fragments on screen
android_fragments_arguments

android_fragments_alert_dialog
android_fragments_alert_dialog.png

android_fragments_context_menu
android_fragments_context_menu.png

android_fragments_custom_animation
android_fragments_custom_animation.png

android_fragments_dialog
android_fragments_dialog.png

android_fragments_dialog_or_activity
android_fragments_dialog_or_activity.png

fragment_hide_show
fragment_hide_show.png

fragment_layout
fragment_layout

fragments_list_array
fragments_list_array.png

fragment_menu
fragment_menu.png

android_fragments_get_result_from_fragment and tabs in two rows
android_fragments_get_result_from_fragment.png

android_fragments_recive_result
android_fragments_recive_result.png

android_fragments_stack
android_fragments_stack.png

fragment_tabs
fragment_tabs.png

Posted in Android Examples Code, Android Studio, Fragments Tutorial | Tagged , | Comments Off on Android Fragment Examples
439 views

Android Studio Browse Files Data Device Emulator

1.) Open DDMS via Menu Tools > Android > Android Device Monitor
2.) Select Device
3.) In DDMS click Menu Window > Show View > File Exlporer
4.) Device > Storage folder
5.) Emulator > data > data folder

Posted in Android Studio, Eclipse | Comments Off on Android Studio Browse Files Data Device Emulator
564 views

Android Software Downloading Possible Only From Play.Google.Com

Software is only available on:


Android Software Downloading Possible Only From Play.Google.Com

Posted in Android Software Download | Tagged | Comments Off on Android Software Downloading Possible Only From Play.Google.Com
564 views