You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I want to place admob ads below every 5 items in fragments.
I tried but i did not could. someone is here who help me
`DemoViewHolder
package baleli.urdupoetrybytariq;
recyclerView = (RecyclerView) view
.findViewById(R.id.recyclerView);
recyclerView.setHasFixedSize(true);
recyclerView
.setLayoutManager(new LinearLayoutManager(getActivity()));//Linear Items
ArrayList<String> arrayList = new ArrayList<>();
arrayList.add(" Koi Raat Mere Aashna, Mujhe Yun Bhi To Naseeb Ho\n" +
" Na Rahe Khayal Libaas Ka, Wo Itna Mere Qareeb Ho\n" +
" Badan Ki Garm Aanch Se Meri Aarzu Ko Aag De\n" +
" Mera Josh Behak Uthey, Mera Haal Bhi Ajeeb Ho\n" +
" Tere Chashni Wajood Ka Sara Ras Mein Chura Loon\n" +
" Phir Tu Hi Mera Marz Ho, Aur Tu Hi Mera Tabeeb Ho");
//As like your can insert data to your ArrayList.
RecyclerView_Adapter adapter = new RecyclerView_Adapter(getActivity(), arrayList);
recyclerView.setAdapter(adapter);// set adapter on recyclerview
I want to place admob ads below every 5 items in fragments.
I tried but i did not could. someone is here who help me
`DemoViewHolder
package baleli.urdupoetrybytariq;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
/**
Created by SONU on 31/08/15.
*/
public abstract class DemoViewHolder extends RecyclerView.ViewHolder {
public TextView title;
public Button shareBtn;
public DemoViewHolder(View view) {
super(view);
}
}`
`RecyclerView_Adapter
package baleli.urdupoetrybytariq;
import android.content.Context;
import android.content.Intent;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import java.util.ArrayList;
/**
Created by SONU on 10/09/15.
*/
public class RecyclerView_Adapter extends
RecyclerView.Adapter {
private ArrayList arrayList;
private Context context;
public RecyclerView_Adapter(Context context,
ArrayList arrayList) {
this.context = context;
this.arrayList = arrayList;
}
@OverRide
public int getItemCount() {
return (null != arrayList ? arrayList.size() : 0);
}
@OverRide
public void onBindViewHolder(DemoViewHolder holder,
int position) {
}
@OverRide
public DemoViewHolder onCreateViewHolder(
ViewGroup viewGroup, int viewType) {
LayoutInflater mInflater = LayoutInflater.from(viewGroup.getContext());
}
}`
Fragments
package baleli.urdupoetrybytariq;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import java.util.ArrayList;
/**
Created by SONU on 16/09/15.
*/
public class Romantic extends Fragment {
private View view;
private String title;//String for tab title
private static RecyclerView recyclerView;
public Romantic() {
}
public Romantic(String title) {
this.title = title;//Setting tab title
}
@nullable
@OverRide
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
view = inflater.inflate(R.layout.dummy_fragment, container, false);
}
//Setting recycler view
private void setRecyclerView() {
}
}
`MainActivity
package baleli.urdupoetrybytariq;
import android.content.Intent;
import android.os.Bundle;
import android.support.design.widget.TabLayout;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import android.support.v4.view.ViewPager;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.TextView;
import com.google.android.gms.ads.AdRequest;
import com.google.android.gms.ads.AdView;
import com.google.android.gms.ads.MobileAds;
import java.util.ArrayList;
import java.util.List;
public class MainActivity extends AppCompatActivity {
private static Toolbar toolbar;
private static ViewPager viewPager;
private static TabLayout tabLayout;
}
`
The text was updated successfully, but these errors were encountered: