0
votes

I'm building my own android application and when i put it on in my Nexus 5 and Xperia Neo works fine, but on Nexus 4 or Galaxy S3 works slowly. I don't know what its happend. Could you help me? I'm working with android:minSdkVersion="14" and android:targetSdkVersion="17", Fragments and one DrawerLayout.

package test.Droidlogin;

import android.content.res.Configuration;

import android.os.Bundle;

import android.support.v4.app.ActionBarDrawerToggle;

import android.support.v4.app.FragmentActivity;

import android.support.v4.widget.DrawerLayout;

import android.view.MenuItem;

import android.view.View;

import android.widget.AdapterView;

import android.widget.AdapterView.OnItemClickListener;

import android.widget.ArrayAdapter;

import android.widget.Button;

import android.widget.ListView;

import android.widget.TextView;

public class Herramientas extends FragmentActivity {

String user;

int iduser;

TextView txt_usr, logoff, txt_iduser;

Button bmiscervezas, bbd, btools, bcrear;

ActionBarDrawerToggle toggle;

String tituloSeccion;

ListView drawer;

public void onCreate(Bundle savedInstanceState) {

       super.onCreate(savedInstanceState);
       setContentView(R.layout.herramientas);

       drawer = (ListView) findViewById(R.id.drawer);
       final DrawerLayout drawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);

       final String[] opciones = {"CONVERSORES", "Temperatura", "Densidad", "Peso", "Volumen", "Presión", "ESPECÍFICAS", "Corrección de Densímetro", "Infusion Step Tool", "Atenuación y Alcohol", 
               "Mash Adjust", "Weight to Volume", "Refractometer", "Carbonation"};
       drawer.setAdapter(new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, android.R.id.text1, opciones));


       drawer.setOnItemClickListener(new OnItemClickListener() {
           @Override
           public void onItemClick(AdapterView<?> parent, View view,
                   int position, long id) {

               android.support.v4.app.Fragment fragment = null;

               switch (position) {
                   case 1:
                       fragment = new HTemperatura();
                       break;
                   case 2:
                       fragment = new HDensidad();
                       break;
                   case 3:
                       fragment = new HPeso();
                       break;
                   case 4:
                       fragment = new HVolumen();
                       break;
                   case 5:
                       fragment = new HPresion();
                       break;
                   case 7:
                       fragment = new HCorreccionDensimetro();
                       break;
                   case 8:
                       fragment = new HInfusionStepTool();
                       break;
                   case 9:
                       fragment = new HAtenuacionyAlcohol();
                       break;
                   case 10:
                       fragment = new HMashAdjust();
                       break;
                   case 11:
                       fragment = new HWeighttoVolume();
                       break;
                   case 12:
                       fragment = new HRefractometer();
                       break;
                   case 13:
                       fragment = new HCarbonation();
                       break;
               }
               if(position != 0 && position != 6){
                   android.support.v4.app.FragmentManager fragmentManager =  getSupportFragmentManager();

                     fragmentManager.beginTransaction()
                           .replace(R.id.content_frame, fragment)
                           .commit();

                     drawer.setItemChecked(position, true);

                     tituloSeccion = opciones[position];


                     getActionBar().setTitle(tituloSeccion);

                     drawerLayout.closeDrawer(drawer);
               }
           }
       });

       //////

       toggle = new ActionBarDrawerToggle(this, drawerLayout,  R.drawable.ic_drawer_aux, R.string.app_name, R.string.hello_world ){

           public void onDrawerClosed(View view) {

           invalidateOptionsMenu();
           }

          public void onDrawerOpened(View drawerView) {
           getActionBar().setTitle("Menú");
           invalidateOptionsMenu();
           }
          };

          drawerLayout.setDrawerListener(toggle);
          //getActionBar().setIcon(R.drawable.ic_drawer_aux);
          getActionBar().setDisplayHomeAsUpEnabled(true);
          getActionBar().setDisplayShowTitleEnabled(true);
          getActionBar().setHomeButtonEnabled(true);


 }
 @Override
 protected void onPostCreate(Bundle savedInstanceState) {
 super.onPostCreate(savedInstanceState);
 toggle.syncState();
 }
 @Override
 public void onConfigurationChanged(Configuration newConfig) {
     super.onConfigurationChanged(newConfig);
     toggle.onConfigurationChanged(newConfig);
 }

 @Override
 public boolean onOptionsItemSelected(MenuItem item) {
     if (toggle.onOptionsItemSelected(item)) {
         return true;
     }
     return super.onOptionsItemSelected(item);
 }

}

1
You need to give more details about the specifics of your code. Can you give a source code example ?Salomon BRYS
I updated de ask adding a part of the code. If you want i can seed the manifest too.user3480270

1 Answers

0
votes

ok, i've found the error. With Lint Warnings i am overdrawing my background. But i don't know how to fix it. i've change this:

 <style name="AppBaseTheme" parent="android:Theme.Holo">
 </style>

to this:

<style name="AppBaseTheme" parent="android:Theme.Holo">
 <item name="android:windowContentOverlay">@null</item>
 <item name="android:windowBackground">@null</item>
</style>

And now i can put on every layout.xml my background. But my problem is that before i change that my buttons looks like a "real button" but now with the new change seems like a TextView without border.