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 9195401
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T21:37:13+00:00 2026-06-17T21:37:13+00:00

I have a list of Clickable TextViews that are relatively doing the same thing.

  • 0

I have a list of Clickable TextViews that are relatively doing the same thing. You click on it and it goes to that activity. Settings goes to the settings activity. About to the about and so forth. Is there an easier way to declare and set up these clickable TextViews besides this repetitious code?

 TextView create,
                         edit,
                         settings,
                         about;

        @Override
        protected void onCreate(Bundle savedInstanceState) {
                super.onCreate(savedInstanceState);
                setContentView(R.layout.activity_navigation);

                create = (TextView) findViewById(R.id.create);
                        create.setTextColor(Color.parseColor("#000000"));
                edit = (TextView) findViewById(R.id.edit);
                        edit.setTextColor(Color.parseColor("#000000"));
                settings = (TextView) findViewById(R.id.settings);
                        settings.setTextColor(Color.parseColor("#000000"));
                about = (TextView) findViewById(R.id.about);
                        about.setTextColor(Color.parseColor("#000000"));

                create.setOnClickListener(new View.OnClickListener(){
                        @Override
                        public void onClick(View v) {

                        }      
                });

                edit.setOnClickListener(new View.OnClickListener(){
                        @Override
                        public void onClick(View v){

                        }
                });

                settings.setOnClickListener(new View.OnClickListener(){
                        @Override
                        public void onClick(View v){

                        }
                });

                about.setOnClickListener(new View.OnClickListener(){
                        @Override
                        public void onClick(View v){

                        }
                });
  • 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-17T21:37:14+00:00Added an answer on June 17, 2026 at 9:37 pm

    If you have a small set of items you can take following approach:

    public class MyActivity extends Activity implements AdapterView.OnItemClickListener {
    
        private ArrayAdapter<Item> mAdapter;
    
        private static enum Item {Create,Edit,Settings,About}
    
        @Override
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
    
            //-- can set up from external layout also--
            ListView list = new ListView(this);
            setContentView(list);
    
            list.setOnItemClickListener(this);
    
            mAdapter = new ArrayAdapter<Item>(this,android.R.layout.simple_list_item_1,Item.values());
            list.setAdapter(mAdapter);
    
        }
    
        @Override
        public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
            switch (mAdapter.getItem(i)){
                case Create:
                    //--do stuff--
                    break;
                case Edit:
                    //--do stuff--
                    break;
                case Settings:
                    //--do stuff--
                    break;
                case About:
                    //--do stuff--
                    break;
            }
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a ListView with items that will navigate on click. The list item
I have to call mapactivity from list activity.whenever user click on item on listview,
i have list of rows that user select and i want to delete them,
I have a main activity that takes elements from a database and displays them
I am developing an Android Application and I have an Activity that looks like
I have an activity with a listview in it. I implemented a custom list
Im looking for the best way of doing something. I have a list with
I have a list that is built like this: <ul id=ajaxList class=ajaxListUL> and then,
I have a ListView list that operates nicely. It's set this way: <style name=Theme.Transparent
I have return a list of results without a problem. When you click on

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.