Soru & Cevap

Admob AdRequest.Builder Hatası ...

27.01.2015 - 09:36

AdView adView = (AdView) this.findViewById(R.id.adView); AdRequest adRequest = new AdRequest.Builder().build(); AdRequest.Builder hata veriyorr adView.loadAd(adRequest); loadAd hata veriyorr google play servisleri ekli bu arada. kodu eklediğimde hata veriyor kodlarımın tamamı ; package com.ilgincbilgiler; import android.app.Activity; import android.content.Context; import android.content.Intent; import android.os.Bundle; import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuInflater; import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; import android.view.animation.Animation; import android.view.animation.AnimationUtils; import android.widget.AdapterView; import android.widget.AdapterView.OnItemClickListener; import android.widget.BaseAdapter; import android.widget.ImageView; import android.widget.ListView; import android.widget.RelativeLayout; import android.widget.TextView; import android.widget.Toast; import com.google.ads.AdRequest; import com.google.android.gms.ads.*; import com.td.rssreader.image.ImageLoader; import com.td.rssreader.parser.DOMParser; import com.td.rssreader.parser.RSSFeed; public class ListActivity extends Activity { AdView adView; RSSFeed feed; ListView lv; CustomListAdapter adapter; String feedLink; private Intent intent; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.feed_list); AdView adView = (AdView) this.findViewById(R.id.adView); AdRequest adRequest = new AdRequest.Builder().build(); adView.loadAd(adRequest); //adView i yüklüyoruz feedLink = new SplashActivity().RSSFEEDURL; // Get feed form the file feed = (RSSFeed) getIntent().getExtras().get("feed"); // Initialize the variables: lv = (ListView) findViewById(R.id.listView); lv.setVerticalFadingEdgeEnabled(true); // Set an Adapter to the ListView adapter = new CustomListAdapter(this); lv.setAdapter(adapter); // Set on item click listener to the ListView lv.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView> arg0, View arg1, int arg2, long arg3) { // actions to be performed when a list item clicked int pos = arg2; Bundle bundle = new Bundle(); bundle.putSerializable("feed", feed); Intent intent = new Intent(ListActivity.this, DetailActivity.class); intent.putExtras(bundle); intent.putExtra("pos", pos); startActivity(intent); } }); } @Override public boolean onCreateOptionsMenu(Menu menu) { new MenuInflater(this).inflate(R.menu.activity_main, menu); return (super.onCreateOptionsMenu(menu)); } @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.refresh_option: refreshList(item); return (true); case R.id.about_option: intent = new Intent(this, secenekler.class); startActivity(intent); return (true); } return super.onOptionsItemSelected(item); } public void refreshList(final MenuItem item) { /* Attach a rotating ImageView to the refresh item as an ActionView */ LayoutInflater inflater = (LayoutInflater) getApplication() .getSystemService(Context.LAYOUT_INFLATER_SERVICE); ImageView iv = (ImageView) inflater.inflate(R.layout.action_refresh, null); Animation rotation = AnimationUtils.loadAnimation(getApplication(), R.anim.refresh_rotate); rotation.setRepeatCount(Animation.INFINITE); iv.startAnimation(rotation); item.setActionView(iv); // trigger feed refresh: Thread thread = new Thread(new Runnable() { @Override public void run() { DOMParser tmpDOMParser = new DOMParser(); feed = tmpDOMParser.parseXml(feedLink); ListActivity.this.runOnUiThread(new Runnable() { @Override public void run() { if (feed != null && feed.getItemCount() > 0) { adapter.notifyDataSetChanged(); // lv.setAdapter(adapter); item.getActionView().clearAnimation(); item.setActionView(null); } } }); } }); thread.start(); } @Override protected void onDestroy() { super.onDestroy(); adapter.imageLoader.clearCache(); adapter.notifyDataSetChanged(); } // List adapter class class CustomListAdapter extends BaseAdapter { private LayoutInflater layoutInflater; public ImageLoader imageLoader; public CustomListAdapter(ListActivity activity) { layoutInflater = (LayoutInflater) activity .getSystemService(Context.LAYOUT_INFLATER_SERVICE); imageLoader = new ImageLoader(activity.getApplicationContext()); } @Override public int getCount() { // Set the total list item count return feed.getItemCount(); } @Override public Object getItem(int position) { return position; } @Override public long getItemId(int position) { return position; } @Override public View getView(int position, View convertView, ViewGroup parent) { // Inflate the item layout and set the views View listItem = convertView; int pos = position; if (listItem == null) { listItem = layoutInflater.inflate(R.layout.list_item, null); } // Initialize the views in the layout ImageView iv = (ImageView) listItem.findViewById(R.id.thumb); TextView tvTitle = (TextView) listItem.findViewById(R.id.title); TextView tvDate = (TextView) listItem.findViewById(R.id.date); // Set the views in the layout imageLoader.DisplayImage(feed.getItem(pos).getImage(), iv); tvTitle.setText(feed.getItem(pos).getTitle()); tvDate.setText(feed.getItem(pos).getDate()); return listItem; } } }

20 Görüntülenme

1 Cevap

Sitedeki sorulara cevap verebilmek için giriş yapın ya da üye olun.

Profile picture for user osman.asar
osman.asar
14.12.2019 - 12:41

Loglarını atma şansın var mı?