About us Contact us privacy policy

Thursday, March 12, 2020

INTERSTITIAL AD by KIMJOH



InterstitialAd interstitialAdMob;


//SHOW AD






loadInterstitialAdMob();

//METHOD







private void loadInterstitialAdMob() {
    interstitialAdMob = new InterstitialAd(this);
    interstitialAdMob.setAdUnitId(Constants.ADS_ADMOB_FULLSCREEN_ID);
    AdRequest adRequest = new AdRequest.Builder().build();
    interstitialAdMob.loadAd(adRequest);
    interstitialAdMob.setAdListener(new AdListener() {
        @Override        public void onAdLoaded() {
            interstitialAdMob.show();
        }
    });
}



// INTERSTITIAL AD ON ADAPTER
private void loadInterstitialAdMob() {
   // interstitialAdMob = new com.google.android.gms.ads.InterstitialAd(context);    interstitialAdMob = new InterstitialAd(context);
    interstitialAdMob.setAdUnitId(context.getString(R.string.admob_interstitial));
    AdRequest adRequest = new AdRequest.Builder().build();
    interstitialAdMob.loadAd(adRequest);
    interstitialAdMob.setAdListener(new AdListener() {
        @Override        public void onAdLoaded() {
            interstitialAdMob.show();
        }
    });
}

Read More »

Sunday, April 7, 2019

SHOW INTERSTITIAL ON START && AT INTERVAL

if (mInterstitialAd.isLoaded()) {
    if (check()) {
        mInterstitialAd.show();
        mInterstitialAd.setAdListener(new AdListener() {
            @Override            public void onAdClosed() {
                super.onAdClosed();
                requestNewInterstitial();





++++++++++++++++++++++
if (mInterstitialAd.isLoaded()) {
    mInterstitialAd.show();

    mInterstitialAd.setAdListener(new AdListener() {
        @Override        public void onAdClosed() {
            super.onAdClosed();
            //  requestNewInterstitial();        }
    });
}
++++++++++++++++++++++


if (clickPosition % 2 == 0) {
    if (mInterstitialAd.isLoaded()) {
        mInterstitialAd.show();
mInterstitialAd.setAdListener(new AdListener() {
            @Override            public void onAdClosed() {
                super.onAdClosed();
                requestNewInterstitial();
} clickPosition++; }






++++++++++++++++++++++++++++++++++++++++
mInterstitialAd = new InterstitialAd(this);
mInterstitialAd.setAdUnitId(getString(R.string.ad_unit_id_interstitial));
mInterstitialAd.loadAd(new AdRequest.Builder().build());


mInterstitialAd.setAdListener(new AdListener() {
    @Override    public void onAdLoaded() {

        if (mInterstitialAd.isLoaded()) {
            mInterstitialAd.show();
        }
    }

    @Override    public void onAdClosed() {
        super.onAdClosed();
        //mInterstitialAd.loadAd(new AdRequest.Builder().build());        //requestNewInterstitial();    }

});

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++



mInterstitialAd = new InterstitialAd(this);
mInterstitialAd.setAdUnitId(getString(R.string.admob_interstitial_id));

AdRequest adRequest = new AdRequest.Builder()
        .build();
easyRatingDialog = new EasyRatingDialog(this);


// Load ads into Interstitial AdsmInterstitialAd.loadAd(adRequest);

mInterstitialAd.setAdListener(new AdListener() {
    public void onAdLoaded() {
        showInterstitial1();
    }
});
Read More »

Friday, March 8, 2019

Material Home Page Design (Dashboard) in android studio



Material Home Page Design (Dashboard) in android studio



https://awsrh.blogspot.com/2017/11/home-dashboard-design-in-android-studio.html
Read More »

Saturday, February 23, 2019

Navigation Drawer with Fragments Part 1 - MENU AND ACTIVITY THEME - Android Studio Tutorial



Navigation Drawer with Fragments Part 1 - MENU AND ACTIVITY THEME - Android Studio Tutorial

Read More »

Friday, February 22, 2019

CARDVIEW TUTORIAL

https://www.androidhive.info/2016/05/android-working-with-card-view-and-recycler-view/
Read More »

Thursday, February 21, 2019

INTENTS ANDROID TUTORIAL

https://www.vogella.com/tutorials/AndroidIntent/article.html




READ MORE

Current responses are great but a more comprehensive answer is needed for beginners. There are 3 different ways to start a new activity in Android, and they all use the Intent class; Intent | Android Developers.
  1. Using the onClick attribute of the Button. (Beginner)
  2. Assigning an OnClickListener() via an anonymous class. (Intermediate)
  3. Activity wide interface method using the switch statement. (Pro)
Here's the link to my example if you want to follow along: https://github.com/martinsing/ToNewActivityButtons

1. Using the onClick attribute of the Button. (Beginner)

Buttons have an onClick attribute that is found within the .xml file:
<Button
    android:id="@+id/button1"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:onClick="goToAnActivity"
    android:text="to an activity" />

<Button
    android:id="@+id/button2"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:onClick="goToAnotherActivity"
    android:text="to another activity" />
In Java class:
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main_activity);
}

public void goToAnActivity(View view) {
    Intent intent = new Intent(this, AnActivity.class);
    startActivity(intent);
}

public void goToAnotherActivity(View view) {
    Intent intent = new Intent(this, AnotherActivity.class);
    startActivity(intent);
}
Advantage: Easy to make on the fly, modular, and can easily set multiple onClicks to the same intent.
Disadvantage: Difficult readability when reviewing.

2. Assigning an OnClickListener() via an anonymous class. (Intermediate)

This is when you set a separate setOnClickListener() to each button and override each onClick() with its own intent.
In Java class:
@Override
protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main_activity);

        button1 = (Button) findViewById(R.id.button1);
        button1.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Intent intent = new Intent(view.getContext(), AnActivity.class);
                view.getContext().startActivity(intent);}
            });

        button2 = (Button) findViewById(R.id.button2);
        button2.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Intent intent = new Intent(view.getContext(), AnotherActivity.class);
                view.getContext().startActivity(intent);}
            });
Advantage: Easy to make on the fly.
Disadvantage: There will be a lot of anonymous classes which will make readability difficult when reviewing.

3. Activity wide interface method using the switch statement. (Pro)

This is when you use a switch statement for your buttons within the onClick() method to manage all the Activity's buttons.
In Java class:
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main_activity);

    button1 = (Button) findViewById(R.id.button1);
    button2 = (Button) findViewById(R.id.button2);
    button1.setOnClickListener(this);
    button2.setOnClickListener(this);
}

@Override
public void onClick(View view) {
    switch (view.getId()){
        case R.id.button1:
            Intent intent1 = new Intent(this, AnActivity.class);
            startActivity(intent1);
            break;
        case R.id.button2:
            Intent intent2 = new Intent(this, AnotherActivity.class);
            startActivity(intent2);
            break;
        default:
            break;
    }
Advantage: Easy button management because all button intents are registered in a single onClick() method
Read More »