Results 1 to 1 of 1
  1. #1
    Junior Member
    Join Date
    Jan 2013
    Posts
    17
    Post Thanks / Like
    Mentioned
    2 Post(s)

    Problem with android 2.3.6

    Hi,

    I have a word game that has a bug on specific phones/ or specific android builds. It's been accepted by Amazon, but rejected by Slideme and Samsung apps.

    When I submitted it to Samsung, the errors all came back against android build 2.3.6.

    I have a category list that is just a simple list view, when you click on one of the categories , I read from a text file, store that information away in the application object then call a new activity to start the game with data from the text file. It has no problems on my HTC Ons S or Samsung Galaxy S3, or HTC Desire, otherwise I'd be able to debug it. On the affected Android build, it doesn't give any errors or anything, but when you click on the category list it does nothing at all! Samsung sent me a video of this.

    Any help would be really appreciated. I'd really love to fix this bug.

    Here's the layout:

    Code:
    <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content" >
    
            <ListView
                android:id="@+id/categoryList"
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:layout_margin="12dp"
                android:layout_weight="1"
                 >
            </ListView>
        </LinearLayout>
    My categories activity:

    Code:
    WordListLoader database;
    	 protected AdView adView;
    	private ListView m_categoryList;
    	private MissingVowelsApplication m_app;
    
    
    	public void onCreate(Bundle savedInstanceState) {
    	        super.onCreate(savedInstanceState);
    	        setContentView(R.layout.activity_category);
    
    	        m_app = (MissingVowelsApplication) getApplicationContext();
    	        
    	        createCategoriesList(); 
    	        setAdverts();
    	        setFonts(); 
    
    	    }
    
    	private void createCategoriesList() {
    	     m_categoryList = (ListView) findViewById(R.id.categoryList); 
    
    				ArrayList<String> highScoreCatList = new ArrayList<String>(CategoryList.getCategoryList());
    
    				ArrayAdapter<String> listAdapter = new ArrayAdapter<String>(this, R.layout.high_score_row,
    						highScoreCatList);
    
    				// Set the ArrayAdapter as the ListView's adapter.
    				m_categoryList.setAdapter(listAdapter);
    
    				m_categoryList.setTextFilterEnabled(true);
    				
    				m_categoryList.setOnItemClickListener(new OnItemClickListener() {
    				      public void onItemClick(AdapterView<?> parent, View view,
    				          int position, long id) {
    						
    				    	  String indexStr = (String) m_categoryList.getItemAtPosition(position);
    				    	  indexStr = indexStr.toLowerCase();
    				    	  indexStr = indexStr.replaceAll(" ", "_");
    				    	  
    				    	  WordListLoader wordLoader = new WordListLoader(m_app); 
    				    	
    				    	  wordLoader.loadDictionary(indexStr); 
    				    	  m_app.setWordList(wordLoader.getWordList());
    				    	  createIntent(indexStr, view); 
    				    	 
    				    }
    
    				});		
    		
    	}
    
    	protected void createIntent(String indexStr, View view) {
    		  Intent myIntent = new Intent(view.getContext(), Game.class);
    		 myIntent.putExtra("category",indexStr);
               startActivityForResult(myIntent, 0);
    	}
    And my word list loader:

    Code:
    public class WordListLoader {
    	
        private static final String TAG = "DictionaryDatabase";
    
    	  // private final Context mHelperContext;
    	private ArrayList<String> m_wordList;
    	  /**
         * Starts a thread to load the database table with words
         */
    
    	private Context m_Context;
    
    	private int m_position;
    	
        /**
         * Constructor
         *  @param context The Context within which to work, used to create the DB
         */
        public WordListLoader(Context context) {
            m_Context = context;
            m_wordList = new ArrayList<String>(); 
        }
    	
        public void loadDictionary(String category) {
            
                    try {
                    	if (m_wordList == null ||
                    			m_wordList.isEmpty() )
                        loadWords(category);
                    } catch (IOException e) {
                        throw new RuntimeException(e);
                    }
                }
           
    	
    	
        private ArrayList<String> loadWords(String fileName) throws IOException {
        //    Log.d(TAG, "Loading words...");
            final Resources resources = m_Context.getResources();
            
    
            int id = resources.getIdentifier("com.fifeshire.missingvowelsfree:raw/"+fileName, null, null);
            if (id != 0)
            {
            InputStream inputStream = resources.openRawResource(id);
            BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream));
    
            try {
                String line;
                while ((line = reader.readLine()) != null && line.trim().length() > 0) {
                    addWord(line);            
                }
            } finally {
                reader.close();
            }
         //   Log.d(TAG, "DONE loading words.");
            }
            return m_wordList; 
        }
        
        /**
         * Add a word to the dictionary.
         * @return rowId or -1 if failed
         */
        public void addWord(String word) {
        	
           m_wordList.add(word); 
        }
        
    
    	public String getRandomWord() {
    		Random generator = new Random();
    		m_position = generator.nextInt( m_wordList.size());
    		String randomValue = m_wordList.get(m_position); 
    		
    		return randomValue;
    	}
    	
    	public ArrayList<String> getWordList() {
    		return m_wordList; 
    	}
    	
    	public String getNextWord() { 
    		if (m_position >= m_wordList.size())
    		{
    			m_position = 0;
    		}
    		String word  = m_wordList.get(m_position);
    		Random generator = new Random();
    		m_position = m_position + (generator.nextInt(4) + 1);
    		return word; 
    	}
        
    
        
       
    }
    Last edited by MikeMcK; 2013-01-30 at 10:24 AM.

Similar Threads

  1. Admob problem
    By Babuye in forum Advertising Networks
    Replies: 7
    Last Post: 2017-09-07, 10:57 PM
  2. Problem with Airpush
    By kamelia77 in forum Advertising Networks
    Replies: 21
    Last Post: 2014-12-04, 06:23 PM
  3. Big problem with Airpush!
    By s-leaf in forum Advertising Networks
    Replies: 4
    Last Post: 2013-05-02, 03:28 PM
  4. Would Adblock plus be a problem ?
    By sarunw in forum Advertising Networks
    Replies: 8
    Last Post: 2012-12-03, 03:45 PM
  5. httprequest problem
    By Wolfgang in forum Android Development
    Replies: 4
    Last Post: 2012-08-19, 03:53 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •