60 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
68 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
79 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
133 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
98 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
111 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
209 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
358 views

All com.android.support libraries must use the exact same version specification

For example:
If You using
compileSdkVersion 25
buildToolsVersion "25.0.0"

You have to using latest version of support libraries with number 25.
Also check the library project!

 
apply plugin: 'com.android.application'
 
android {
    compileSdkVersion 25
    buildToolsVersion "25.0.0"
 
    defaultConfig {
        applicationId "cz.okhelp.prislovi_cz_test"
        minSdkVersion 13
        targetSdkVersion 25
    }
 
    buildTypes {
        release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-project.txt'
 
        }
    }
}
 
dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    testCompile 'junit:junit:4.12'
    compile project(':library_studio')
 
    /*  ERROR message: You have to update 
     compile 'com.android.support:appcompat-v7:23.4.0'
     compile 'com.android.support:design:23.4.0'
    */
 
    compile 'com.android.support:support-v4:25.1.0'
    compile 'com.android.support:appcompat-v7:25.1.0'
    compile 'com.android.support:design:25.1.0'
}

Update in module build.gradle file
or
select from menu File -> Project Structure and set up correct libraries.

Posted in Android Studio, Bugs, warnings, errors | Tagged , | Comments Off on All com.android.support libraries must use the exact same version specification
745 views

InterstitialAd Admob not visible

// on bottom of onCreate add listener
mInterstitialAd .setAdListener(new AdListener(){
     public void onAdLoaded(){
          interstitial.show();
     }
});
 
} // end onCreate
 
 public void displayInterstitial (){
        if (mInterstitialAd.isLoaded()) {
            mInterstitialAd.show();
        }
    }
Posted in Android Studio, Bugs, warnings, errors | Tagged | Comments Off on InterstitialAd Admob not visible
692 views

Android Studio emulator errors warnings issue

– check errors, warnings in build.gradle and other files
– Sync project
– Clean project
– Rebuild project
– restart Android Studio
– restart ADB
– update Tools, libraries, etc.

Speed Up Gradle Build In Android Studio

-a android.intent.action.MAIN -c android.intent.category.LAUNCHER
Unexpected error while executing: am start -n

Try run app again, or open app from emulator.

Admob not visible on emulator:

InterstitialAd
Use listener
in https://firebase.google.com/docs/admob/android/existing-app

// onCreate
mInterstitialAd .setAdListener(new AdListener(){
public void onAdLoaded(){
interstitial.show();
}
});
// ! onCreate

public void displayInterstitial (){
if (mInterstitialAd.isLoaded()) {
mInterstitialAd.show();
}
}

Ads: There was a problem getting an ad response. ErrorCode: 0
Solution:
Update Android with Google APIs. Run emulator Android xx with (Google APIs)
module.gradle
Check:
compile ‘com.google.android.gms:play-services:8.4.0′
Maybe you have to update version of play-services.

Posted in Android Studio, Bugs, warnings, errors | Tagged , | Comments Off on Android Studio emulator errors warnings issue
692 views