Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8379583
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T16:13:43+00:00 2026-06-09T16:13:43+00:00

I tried everything. I tested by copy pasting the example here from developer website

  • 0

I tried everything. I tested by copy pasting the example here from developer website but still didnt do work. it just shows a blank space whee the gridview was supposed to come. Here is my code.
EnterApp.java

package com.locationremind.app;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.Window;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.GridView;
import android.widget.Toast;

public class EnterApp extends Activity {
    Context con;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        // TODO Auto-generated method stub
        super.onCreate(savedInstanceState);
        con=this;
        this.requestWindowFeature(Window.FEATURE_NO_TITLE);
        setContentView(R.layout.enterapp);
        GridView gridView=(GridView) findViewById(R.id.grid_menu);
        gridView.setAdapter(new MyAdapter(this));
        gridView.setOnItemClickListener(new OnItemClickListener(){

            @Override
            public void onItemClick(AdapterView<?> parent, View v, int position,
                    long id) {
                // TODO Auto-generated method stub
                if(position==0)
                    startActivity(new Intent(getBaseContext(),LocationReminderActivity.class));
                else
                    Toast.makeText(getBaseContext(), "Item"+position+"not Allocated yet",Toast.LENGTH_SHORT).show();

            }

        });
    }


}

MyAdapter.java

package com.locationremind.app;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.GridView;
import android.widget.TextView;

public class MyAdapter extends BaseAdapter {
    Context context;

    public MyAdapter(Context c) {
        context = c;

    }
    @Override
    public int getCount() {
        // TODO Auto-generated method stub
        return 0;
    }

    @Override
    public Object getItem(int pos) {
        // TODO Auto-generated method stub
        return null;
    }

    @Override
    public long getItemId(int position) {
        // TODO Auto-generated method stub
        return 0;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        // TODO Auto-generated method stub
        TextView tv;
        /*ImageView imageView;
        WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
        Display display = wm.getDefaultDisplay();*/
        if(convertView==null)
        {    
            tv=new TextView(context);
            tv.setLayoutParams(new GridView.LayoutParams(85,85));

        }
        else
            tv=(TextView)convertView;
        tv.setBackgroundResource(thumbsID[position]);
        tv.setMinimumHeight(128);
        tv.setMinimumWidth(128);
        tv.setLayoutParams(new GridView.LayoutParams(85,85));
        tv.setText(text[position]);
        return tv;
    }

    private Integer[] thumbsID={R.drawable.gridview_icon,R.drawable.icn};
    private String[] text={"Select Location Using GPS","Select Location Using Wi-Fi",
                          "Select Location Using Network","Settings"};
}

enterapp.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical"
    android:id="@+id/Rlayout"
     >
    <ImageView 
        android:id="@+id/img_icon"
        android:src="@drawable/android"
        android:maxWidth="80dp"
        android:maxHeight="80dp"
        android:layout_width="64px"
        android:layout_height="64px"
        android:contentDescription="logo-icon"/>
    <GridView 
        android:id="@+id/grid_menu"
        android:layout_width="fill_parent" 
        android:layout_height="fill_parent"
        android:columnWidth="90dp"
        android:numColumns="auto_fit"
        android:verticalSpacing="10dp"
        android:horizontalSpacing="10dp"
        android:stretchMode="columnWidth"
        android:gravity="center"/>

</LinearLayout>  
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T16:13:45+00:00Added an answer on June 9, 2026 at 4:13 pm

    you mistake lies in your adapter as

    @Override
    public int getCount() {
        // TODO Auto-generated method stub
        return 0;
    }
    

    saying you dont have any item to display that is why its not showing any element.

    to solve this change your getCount() like this

    @Override
    public int getCount() {
        // TODO Auto-generated method stub
        return thumbsID.length;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Having an issue here that I have tried everything I can think of but
I tried everything to debug this one but I can't get to the bottom
I've tried everything and it still fails! What's wrong with this code?!?! I wanted
I have nearly tried everything but cannot figure out what is wrong. I have
I search everywhere and tried everything I could, but I cannot make my second
I've found solutions for manipulating everything except what I need. Here's the scenario Just
I tried everything to get this code working, and I hope someone will save
I have tried everything in the book and EVERYTHING I could find on how
I've tried everything. Every combination of the helpers raw , html_safe to_json including some
I've tried everything... it won't hide. Obviously tried Mouse.hide() tried different player versions (10.2,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.