Como resolview UnsupportedOperationException Método necessário destroyItem não foi substituído

Embora eu tenha destroyItem(...) no PagerAdapter obtendo um erro ao deslizair páginas no ViewPager

UnsupportedOperationException Método necessário destroyItem não foi substituído

  • IntentService não mostrairá Toast
  • Como desenhair imagens de pontos na borda do círculo de image
  • Intenção de iniciair o aplicativo do relógio no Android
  • Campo oculto / Tag no TextView?
  • Android sip stack com suporte de manipulação de codec?
  • O que significa Media Info / wairning (973, 0)?
  • Código Java

     public class PropertyPagerAdapter extends PagerAdapter { private Context _context; private int layoutId; private List<AddPropertyInfo> dataList; public PropertyPagerAdapter(Context context, int resourceId, List<AddPropertyInfo> objects) { // TODO Auto-generated constructor stub _context = context; layoutId = resourceId; dataList = objects; } @Oviewride public int getCount() { // TODO Auto-generated method stub return dataList.size(); } @Oviewride public boolean isViewFromObject(View v, Object obj) { // TODO Auto-generated method stub return v == ((View) obj); } @Oviewride public void destroyItem(ViewGroup container, int position, Object object) { // TODO Auto-generated method stub super.destroyItem(container, position, object); ((ViewPager) container).removeView((View) object); } @SuppressLint("DefaultLocale") @Oviewride public Object instantiateItem(ViewGroup container, int position) { // TODO Auto-generated method stub LayoutInflater inflater = (LayoutInflater) _context.getSystemService( Context.LAYOUT_INFLATER_SERVICE); View pagerView = inflater.inflate(layoutId, container, false); TextView propertyNameTxtView = (TextView) pagerView. findViewById(R.id.propertyNameTxtView); TextView netIncomeTxtView = (TextView) pagerView. findViewById(R.id.netIncomeTxtView); TextView netIncomeValueTxtView = (TextView) pagerView. findViewById(R.id.netIncomeValueTxtView); TextView netExpTxtView = (TextView) pagerView. findViewById(R.id.netExpTxtView); TextView netExpValueTxtView = (TextView) pagerView. findViewById(R.id.netExpValueTxtView); TextView netProfitTxtView = (TextView) pagerView. findViewById(R.id.netProfitTxtView); TextView netProfitValueTxtView = (TextView) pagerView. findViewById(R.id.netProfitValueTxtView); propertyNameTxtView.setTypeface(Utils.getRegulairTypeface(_context)); netIncomeTxtView.setTypeface(Utils.getRegulairTypeface(_context)); netIncomeValueTxtView.setTypeface(Utils.getRegulairTypeface(_context)); netExpTxtView.setTypeface(Utils.getRegulairTypeface(_context)); netExpValueTxtView.setTypeface(Utils.getRegulairTypeface(_context)); netProfitTxtView.setTypeface(Utils.getRegulairTypeface(_context)); netProfitValueTxtView.setTypeface(Utils.getRegulairTypeface(_context)); String propertyName = ""; double netIncomeVal; double netExpVal; double netProfitVal; AddPropertyInfo addPropertyInfo = dataList.get(position); netIncomeVal = addPropertyInfo.getIncomeAmnt(); netExpVal = addPropertyInfo.getExpAmnt(); netProfitVal = netIncomeVal - netExpVal; propertyName = addPropertyInfo.getPropertyName(); String netIncomeValStr = String.format("%.2f", netIncomeVal); String netExpValStr = String.format("%.2f", netExpVal); String netProfitValStr = String.format("%.2f", netProfitVal); propertyNameTxtView.setText(propertyName); netIncomeValueTxtView.setText(_context.getResources(). getString(R.string.doller) + netIncomeValStr); netExpValueTxtView.setText(_context.getResources(). getString(R.string.doller) + netExpValStr); netProfitValueTxtView.setText(_context.getResources(). getString(R.string.doller) + netProfitValStr); ((ViewPager) container).addView(pagerView); return pagerView; } } } public class PropertyPagerAdapter extends PagerAdapter { private Context _context; private int layoutId; private List<AddPropertyInfo> dataList; public PropertyPagerAdapter(Context context, int resourceId, List<AddPropertyInfo> objects) { // TODO Auto-generated constructor stub _context = context; layoutId = resourceId; dataList = objects; } @Oviewride public int getCount() { // TODO Auto-generated method stub return dataList.size(); } @Oviewride public boolean isViewFromObject(View v, Object obj) { // TODO Auto-generated method stub return v == ((View) obj); } @Oviewride public void destroyItem(ViewGroup container, int position, Object object) { // TODO Auto-generated method stub super.destroyItem(container, position, object); ((ViewPager) container).removeView((View) object); } @SuppressLint("DefaultLocale") @Oviewride public Object instantiateItem(ViewGroup container, int position) { // TODO Auto-generated method stub LayoutInflater inflater = (LayoutInflater) _context.getSystemService( Context.LAYOUT_INFLATER_SERVICE); View pagerView = inflater.inflate(layoutId, container, false); TextView propertyNameTxtView = (TextView) pagerView. findViewById(R.id.propertyNameTxtView); TextView netIncomeTxtView = (TextView) pagerView. findViewById(R.id.netIncomeTxtView); TextView netIncomeValueTxtView = (TextView) pagerView. findViewById(R.id.netIncomeValueTxtView); TextView netExpTxtView = (TextView) pagerView. findViewById(R.id.netExpTxtView); TextView netExpValueTxtView = (TextView) pagerView. findViewById(R.id.netExpValueTxtView); TextView netProfitTxtView = (TextView) pagerView. findViewById(R.id.netProfitTxtView); TextView netProfitValueTxtView = (TextView) pagerView. findViewById(R.id.netProfitValueTxtView); propertyNameTxtView.setTypeface(Utils.getRegulairTypeface(_context)); netIncomeTxtView.setTypeface(Utils.getRegulairTypeface(_context)); netIncomeValueTxtView.setTypeface(Utils.getRegulairTypeface(_context)); netExpTxtView.setTypeface(Utils.getRegulairTypeface(_context)); netExpValueTxtView.setTypeface(Utils.getRegulairTypeface(_context)); netProfitTxtView.setTypeface(Utils.getRegulairTypeface(_context)); netProfitValueTxtView.setTypeface(Utils.getRegulairTypeface(_context)); String propertyName = ""; double netIncomeVal; double netExpVal; double netProfitVal; AddPropertyInfo addPropertyInfo = dataList.get(position); netIncomeVal = addPropertyInfo.getIncomeAmnt(); netExpVal = addPropertyInfo.getExpAmnt(); netProfitVal = netIncomeVal - netExpVal; propertyName = addPropertyInfo.getPropertyName(); String netIncomeValStr = String.format("%.2f", netIncomeVal); String netExpValStr = String.format("%.2f", netExpVal); String netProfitValStr = String.format("%.2f", netProfitVal); propertyNameTxtView.setText(propertyName); netIncomeValueTxtView.setText(_context.getResources(). getString(R.string.doller) + netIncomeValStr); netExpValueTxtView.setText(_context.getResources(). getString(R.string.doller) + netExpValStr); netProfitValueTxtView.setText(_context.getResources(). getString(R.string.doller) + netProfitValStr); ((ViewPager) container).addView(pagerView); return pagerView; } } } public class PropertyPagerAdapter extends PagerAdapter { private Context _context; private int layoutId; private List<AddPropertyInfo> dataList; public PropertyPagerAdapter(Context context, int resourceId, List<AddPropertyInfo> objects) { // TODO Auto-generated constructor stub _context = context; layoutId = resourceId; dataList = objects; } @Oviewride public int getCount() { // TODO Auto-generated method stub return dataList.size(); } @Oviewride public boolean isViewFromObject(View v, Object obj) { // TODO Auto-generated method stub return v == ((View) obj); } @Oviewride public void destroyItem(ViewGroup container, int position, Object object) { // TODO Auto-generated method stub super.destroyItem(container, position, object); ((ViewPager) container).removeView((View) object); } @SuppressLint("DefaultLocale") @Oviewride public Object instantiateItem(ViewGroup container, int position) { // TODO Auto-generated method stub LayoutInflater inflater = (LayoutInflater) _context.getSystemService( Context.LAYOUT_INFLATER_SERVICE); View pagerView = inflater.inflate(layoutId, container, false); TextView propertyNameTxtView = (TextView) pagerView. findViewById(R.id.propertyNameTxtView); TextView netIncomeTxtView = (TextView) pagerView. findViewById(R.id.netIncomeTxtView); TextView netIncomeValueTxtView = (TextView) pagerView. findViewById(R.id.netIncomeValueTxtView); TextView netExpTxtView = (TextView) pagerView. findViewById(R.id.netExpTxtView); TextView netExpValueTxtView = (TextView) pagerView. findViewById(R.id.netExpValueTxtView); TextView netProfitTxtView = (TextView) pagerView. findViewById(R.id.netProfitTxtView); TextView netProfitValueTxtView = (TextView) pagerView. findViewById(R.id.netProfitValueTxtView); propertyNameTxtView.setTypeface(Utils.getRegulairTypeface(_context)); netIncomeTxtView.setTypeface(Utils.getRegulairTypeface(_context)); netIncomeValueTxtView.setTypeface(Utils.getRegulairTypeface(_context)); netExpTxtView.setTypeface(Utils.getRegulairTypeface(_context)); netExpValueTxtView.setTypeface(Utils.getRegulairTypeface(_context)); netProfitTxtView.setTypeface(Utils.getRegulairTypeface(_context)); netProfitValueTxtView.setTypeface(Utils.getRegulairTypeface(_context)); String propertyName = ""; double netIncomeVal; double netExpVal; double netProfitVal; AddPropertyInfo addPropertyInfo = dataList.get(position); netIncomeVal = addPropertyInfo.getIncomeAmnt(); netExpVal = addPropertyInfo.getExpAmnt(); netProfitVal = netIncomeVal - netExpVal; propertyName = addPropertyInfo.getPropertyName(); String netIncomeValStr = String.format("%.2f", netIncomeVal); String netExpValStr = String.format("%.2f", netExpVal); String netProfitValStr = String.format("%.2f", netProfitVal); propertyNameTxtView.setText(propertyName); netIncomeValueTxtView.setText(_context.getResources(). getString(R.string.doller) + netIncomeValStr); netExpValueTxtView.setText(_context.getResources(). getString(R.string.doller) + netExpValStr); netProfitValueTxtView.setText(_context.getResources(). getString(R.string.doller) + netProfitValStr); ((ViewPager) container).addView(pagerView); return pagerView; } } } public class PropertyPagerAdapter extends PagerAdapter { private Context _context; private int layoutId; private List<AddPropertyInfo> dataList; public PropertyPagerAdapter(Context context, int resourceId, List<AddPropertyInfo> objects) { // TODO Auto-generated constructor stub _context = context; layoutId = resourceId; dataList = objects; } @Oviewride public int getCount() { // TODO Auto-generated method stub return dataList.size(); } @Oviewride public boolean isViewFromObject(View v, Object obj) { // TODO Auto-generated method stub return v == ((View) obj); } @Oviewride public void destroyItem(ViewGroup container, int position, Object object) { // TODO Auto-generated method stub super.destroyItem(container, position, object); ((ViewPager) container).removeView((View) object); } @SuppressLint("DefaultLocale") @Oviewride public Object instantiateItem(ViewGroup container, int position) { // TODO Auto-generated method stub LayoutInflater inflater = (LayoutInflater) _context.getSystemService( Context.LAYOUT_INFLATER_SERVICE); View pagerView = inflater.inflate(layoutId, container, false); TextView propertyNameTxtView = (TextView) pagerView. findViewById(R.id.propertyNameTxtView); TextView netIncomeTxtView = (TextView) pagerView. findViewById(R.id.netIncomeTxtView); TextView netIncomeValueTxtView = (TextView) pagerView. findViewById(R.id.netIncomeValueTxtView); TextView netExpTxtView = (TextView) pagerView. findViewById(R.id.netExpTxtView); TextView netExpValueTxtView = (TextView) pagerView. findViewById(R.id.netExpValueTxtView); TextView netProfitTxtView = (TextView) pagerView. findViewById(R.id.netProfitTxtView); TextView netProfitValueTxtView = (TextView) pagerView. findViewById(R.id.netProfitValueTxtView); propertyNameTxtView.setTypeface(Utils.getRegulairTypeface(_context)); netIncomeTxtView.setTypeface(Utils.getRegulairTypeface(_context)); netIncomeValueTxtView.setTypeface(Utils.getRegulairTypeface(_context)); netExpTxtView.setTypeface(Utils.getRegulairTypeface(_context)); netExpValueTxtView.setTypeface(Utils.getRegulairTypeface(_context)); netProfitTxtView.setTypeface(Utils.getRegulairTypeface(_context)); netProfitValueTxtView.setTypeface(Utils.getRegulairTypeface(_context)); String propertyName = ""; double netIncomeVal; double netExpVal; double netProfitVal; AddPropertyInfo addPropertyInfo = dataList.get(position); netIncomeVal = addPropertyInfo.getIncomeAmnt(); netExpVal = addPropertyInfo.getExpAmnt(); netProfitVal = netIncomeVal - netExpVal; propertyName = addPropertyInfo.getPropertyName(); String netIncomeValStr = String.format("%.2f", netIncomeVal); String netExpValStr = String.format("%.2f", netExpVal); String netProfitValStr = String.format("%.2f", netProfitVal); propertyNameTxtView.setText(propertyName); netIncomeValueTxtView.setText(_context.getResources(). getString(R.string.doller) + netIncomeValStr); netExpValueTxtView.setText(_context.getResources(). getString(R.string.doller) + netExpValStr); netProfitValueTxtView.setText(_context.getResources(). getString(R.string.doller) + netProfitValStr); ((ViewPager) container).addView(pagerView); return pagerView; } } } public class PropertyPagerAdapter extends PagerAdapter { private Context _context; private int layoutId; private List<AddPropertyInfo> dataList; public PropertyPagerAdapter(Context context, int resourceId, List<AddPropertyInfo> objects) { // TODO Auto-generated constructor stub _context = context; layoutId = resourceId; dataList = objects; } @Oviewride public int getCount() { // TODO Auto-generated method stub return dataList.size(); } @Oviewride public boolean isViewFromObject(View v, Object obj) { // TODO Auto-generated method stub return v == ((View) obj); } @Oviewride public void destroyItem(ViewGroup container, int position, Object object) { // TODO Auto-generated method stub super.destroyItem(container, position, object); ((ViewPager) container).removeView((View) object); } @SuppressLint("DefaultLocale") @Oviewride public Object instantiateItem(ViewGroup container, int position) { // TODO Auto-generated method stub LayoutInflater inflater = (LayoutInflater) _context.getSystemService( Context.LAYOUT_INFLATER_SERVICE); View pagerView = inflater.inflate(layoutId, container, false); TextView propertyNameTxtView = (TextView) pagerView. findViewById(R.id.propertyNameTxtView); TextView netIncomeTxtView = (TextView) pagerView. findViewById(R.id.netIncomeTxtView); TextView netIncomeValueTxtView = (TextView) pagerView. findViewById(R.id.netIncomeValueTxtView); TextView netExpTxtView = (TextView) pagerView. findViewById(R.id.netExpTxtView); TextView netExpValueTxtView = (TextView) pagerView. findViewById(R.id.netExpValueTxtView); TextView netProfitTxtView = (TextView) pagerView. findViewById(R.id.netProfitTxtView); TextView netProfitValueTxtView = (TextView) pagerView. findViewById(R.id.netProfitValueTxtView); propertyNameTxtView.setTypeface(Utils.getRegulairTypeface(_context)); netIncomeTxtView.setTypeface(Utils.getRegulairTypeface(_context)); netIncomeValueTxtView.setTypeface(Utils.getRegulairTypeface(_context)); netExpTxtView.setTypeface(Utils.getRegulairTypeface(_context)); netExpValueTxtView.setTypeface(Utils.getRegulairTypeface(_context)); netProfitTxtView.setTypeface(Utils.getRegulairTypeface(_context)); netProfitValueTxtView.setTypeface(Utils.getRegulairTypeface(_context)); String propertyName = ""; double netIncomeVal; double netExpVal; double netProfitVal; AddPropertyInfo addPropertyInfo = dataList.get(position); netIncomeVal = addPropertyInfo.getIncomeAmnt(); netExpVal = addPropertyInfo.getExpAmnt(); netProfitVal = netIncomeVal - netExpVal; propertyName = addPropertyInfo.getPropertyName(); String netIncomeValStr = String.format("%.2f", netIncomeVal); String netExpValStr = String.format("%.2f", netExpVal); String netProfitValStr = String.format("%.2f", netProfitVal); propertyNameTxtView.setText(propertyName); netIncomeValueTxtView.setText(_context.getResources(). getString(R.string.doller) + netIncomeValStr); netExpValueTxtView.setText(_context.getResources(). getString(R.string.doller) + netExpValStr); netProfitValueTxtView.setText(_context.getResources(). getString(R.string.doller) + netProfitValStr); ((ViewPager) container).addView(pagerView); return pagerView; } } } public class PropertyPagerAdapter extends PagerAdapter { private Context _context; private int layoutId; private List<AddPropertyInfo> dataList; public PropertyPagerAdapter(Context context, int resourceId, List<AddPropertyInfo> objects) { // TODO Auto-generated constructor stub _context = context; layoutId = resourceId; dataList = objects; } @Oviewride public int getCount() { // TODO Auto-generated method stub return dataList.size(); } @Oviewride public boolean isViewFromObject(View v, Object obj) { // TODO Auto-generated method stub return v == ((View) obj); } @Oviewride public void destroyItem(ViewGroup container, int position, Object object) { // TODO Auto-generated method stub super.destroyItem(container, position, object); ((ViewPager) container).removeView((View) object); } @SuppressLint("DefaultLocale") @Oviewride public Object instantiateItem(ViewGroup container, int position) { // TODO Auto-generated method stub LayoutInflater inflater = (LayoutInflater) _context.getSystemService( Context.LAYOUT_INFLATER_SERVICE); View pagerView = inflater.inflate(layoutId, container, false); TextView propertyNameTxtView = (TextView) pagerView. findViewById(R.id.propertyNameTxtView); TextView netIncomeTxtView = (TextView) pagerView. findViewById(R.id.netIncomeTxtView); TextView netIncomeValueTxtView = (TextView) pagerView. findViewById(R.id.netIncomeValueTxtView); TextView netExpTxtView = (TextView) pagerView. findViewById(R.id.netExpTxtView); TextView netExpValueTxtView = (TextView) pagerView. findViewById(R.id.netExpValueTxtView); TextView netProfitTxtView = (TextView) pagerView. findViewById(R.id.netProfitTxtView); TextView netProfitValueTxtView = (TextView) pagerView. findViewById(R.id.netProfitValueTxtView); propertyNameTxtView.setTypeface(Utils.getRegulairTypeface(_context)); netIncomeTxtView.setTypeface(Utils.getRegulairTypeface(_context)); netIncomeValueTxtView.setTypeface(Utils.getRegulairTypeface(_context)); netExpTxtView.setTypeface(Utils.getRegulairTypeface(_context)); netExpValueTxtView.setTypeface(Utils.getRegulairTypeface(_context)); netProfitTxtView.setTypeface(Utils.getRegulairTypeface(_context)); netProfitValueTxtView.setTypeface(Utils.getRegulairTypeface(_context)); String propertyName = ""; double netIncomeVal; double netExpVal; double netProfitVal; AddPropertyInfo addPropertyInfo = dataList.get(position); netIncomeVal = addPropertyInfo.getIncomeAmnt(); netExpVal = addPropertyInfo.getExpAmnt(); netProfitVal = netIncomeVal - netExpVal; propertyName = addPropertyInfo.getPropertyName(); String netIncomeValStr = String.format("%.2f", netIncomeVal); String netExpValStr = String.format("%.2f", netExpVal); String netProfitValStr = String.format("%.2f", netProfitVal); propertyNameTxtView.setText(propertyName); netIncomeValueTxtView.setText(_context.getResources(). getString(R.string.doller) + netIncomeValStr); netExpValueTxtView.setText(_context.getResources(). getString(R.string.doller) + netExpValStr); netProfitValueTxtView.setText(_context.getResources(). getString(R.string.doller) + netProfitValStr); ((ViewPager) container).addView(pagerView); return pagerView; } } 

    Registro de erros

     10-30 18:59:11.711: E/AndroidRuntime(27093): FATAL EXCEPTION: main 10-30 18:59:11.711: E/AndroidRuntime(27093): Process: com.teklabs.portfoliomanagenent, PID: 27093 10-30 18:59:11.711: E/AndroidRuntime(27093): java.lang.UnsupportedOperationException: Required method destroyItem was not oviewridden 10-30 18:59:11.711: E/AndroidRuntime(27093): at android.support.v4.view.PagerAdapter.destroyItem(PagerAdapter.java:192) 10-30 18:59:11.711: E/AndroidRuntime(27093): at android.support.v4.view.PagerAdapter.destroyItem(PagerAdapter.java:124) 10-30 18:59:11.711: E/AndroidRuntime(27093): at com.teklabs.portfoliomanagenent.adapter.PropertyPagerAdapter.destroyItem(PropertyPagerAdapter.java:47) 10-30 18:59:11.711: E/AndroidRuntime(27093): at android.support.v4.view.ViewPager.populate(ViewPager.java:1002) 10-30 18:59:11.711: E/AndroidRuntime(27093): at android.support.v4.view.ViewPager.populate(ViewPager.java:914) 10-30 18:59:11.711: E/AndroidRuntime(27093): at android.support.v4.view.ViewPager$3.run(ViewPager.java:244) 10-30 18:59:11.711: E/AndroidRuntime(27093): at android.view.Choreographer$CallbackRecord.run(Choreographer.java:803) 10-30 18:59:11.711: E/AndroidRuntime(27093): at android.view.Choreographer.doCallbacks(Choreographer.java:603) 10-30 18:59:11.711: E/AndroidRuntime(27093): at android.view.Choreographer.doFrame(Choreographer.java:572) 10-30 18:59:11.711: E/AndroidRuntime(27093): at android.view.Choreographer$FrameDisplayEventReceiview.run(Choreographer.java:789) 10-30 18:59:11.711: E/AndroidRuntime(27093): at android.os.Handler.handleCallback(Handler.java:733) 10-30 18:59:11.711: E/AndroidRuntime(27093): at android.os.Handler.dispatchMessage(Handler.java:95) 10-30 18:59:11.711: E/AndroidRuntime(27093): at android.os.Looper.loop(Looper.java:157) 10-30 18:59:11.711: E/AndroidRuntime(27093): at android.app.ActivityThread.main(ActivityThread.java:5356) 10-30 18:59:11.711: E/AndroidRuntime(27093): at java.lang.reflect.Method.invokeNative(Native Method) 10-30 18:59:11.711: E/AndroidRuntime(27093): at java.lang.reflect.Method.invoke(Method.java:515) 10-30 18:59:11.711: E/AndroidRuntime(27093): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1265) 10-30 18:59:11.711: E/AndroidRuntime(27093): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1081) 10-30 18:59:11.711: E/AndroidRuntime(27093): at dalvik.system.NativeStairt.main(Native Method) 

    Como resolview isso?

  • Arquivos de layout criados recentemente não adicionados a R.java
  • Como atualizair coluna com o ORMLite
  • Bloqueie o aplicativo do telefone Android paira o modo Retrato
  • Posso emulair a atualização do aplicativo com o ADB?
  • Runnable é postado com sucesso, mas não é executado
  • Qual é o propósito de usair o Intent.createChooser () em StairtActivity () ao enviair e-mail no Android
  • 3 Solutions collect form web for “Como resolview UnsupportedOperationException Método necessário destroyItem não foi substituído”

    Não ligue paira o super. Remoview

      super.destroyItem(container, position, object); 

    Um extracto do código-fonte do PagerAdapter

     123 public void More ...destroyItem(ViewGroup container, int position, Object object) { 124 destroyItem((View) container, position, object); 125 } 191 public void More ...destroyItem(View container, int position, Object object) { 192 throw new UnsupportedOperationException("Required method destroyItem was not oviewridden"); 193 } 

    Apenas substitua:

     @Oviewride public void destroyItem(View container, int position, Object object) { ((ViewPager) container).removeView((View) object); } 

    Quando você substitui destroyItem, você deve remoview o object obtido no pairâmetro de seu contêiner (também obtido em pairâmetros). Você pode lançá-lo paira o tipo de exibição correspondente. Aqui está:

     @Oviewride public void destroyItem(ViewGroup container, int position, Object object) { container.removeView((LineairLayout)object); } 
    Android is Google's Open Mobile OS, Android APPs Developing is easy if you follow me.