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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T14:45:24+00:00 2026-05-23T14:45:24+00:00

I wish to create a tab application in Android. I wish to basically have

  • 0

I wish to create a tab application in Android.
I wish to basically have four tabs in my application.
Namely, Home, Compose, Inbox, Sent.
I started with a TabContainer extending TabActivity, is this a correct approach.
Since i will be having MenuItem, which i used be having multiple views for Inbox, as such List of inbox, i sud be able to read, and then delete and all.
I wish to know how do I approach?
Basically i wish to make an application similar to gmail.

Any ideas, or direction might help me

public class Inbox extends ListActivity{
    private ProgressDialog progressDialog = null; 
    private ArrayList<EmailElement> emailElement = null;
    private InboxAdapter inboxAdapter;
    private CheckBoxWithInboxList newInboxAdapter;
    private Runnable beforeFetchingEmail;
    private TextView emailFromTextView = null;
    private TextView emailSubjectTextView = null;
    ListView listView;
    private static int mode = 0;
 @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.inbox);

        mode = this.getIntent().getIntExtra("EDIT_MODE", -1);
        Log.i("EDITMODE", String.valueOf(mode));
        emailElement = new ArrayList<EmailElement>();
        if(mode ==0 || mode==-1){
         this.inboxAdapter = new InboxAdapter(this, R.layout.inbox_row, emailElement);
         setListAdapter(inboxAdapter);
        }else{
            this.newInboxAdapter = new CheckBoxWithInboxList(this, R.layout.inbox_row, emailElement);
            setListAdapter(newInboxAdapter);
        }
        beforeFetchingEmail = new Runnable() {
            @Override
            public void run() {
                    getEmails();
                }
            };
            Thread thread =  new Thread(null, beforeFetchingEmail, "MagentoBackground");
            thread.start();
            progressDialog = ProgressDialog.show(Inbox.this,"Please wait...",
                    "Retrieving Emails ...", true);
            listView = getListView();
            listView.setOnItemClickListener(new OnItemClickListener() {

                @Override
                public void onItemClick(AdapterView<?> parentView, View view,
                        int position, long id) {

                    }
                });
}
 private Runnable returnRes = new Runnable() {

        @Override
        public void run() {
            if(emailElement != null && emailElement.size() > 0){
                if(mode==0 || mode==-1){
                    inboxAdapter.notifyDataSetChanged();
                    for(int i=0;i<emailElement.size();i++){
                        inboxAdapter.add(emailElement.get(i));
                    }
                    progressDialog.dismiss();
                    inboxAdapter.notifyDataSetChanged();
                }else{
                    newInboxAdapter.notifyDataSetChanged();
                    for(int i=0;i<emailElement.size();i++){
                        newInboxAdapter.add(emailElement.get(i));
                    }
                    progressDialog.dismiss();
                    newInboxAdapter.notifyDataSetChanged();
                }

            }
        }
    };
 private void getEmails(){
     try{
         emailElement = new ArrayList<EmailElement>();
         EmailElement ee0 = new EmailElement();
         ee0.setFrom("Robin Thapa");
         ee0.setSubject("Urgent Meeting");
         emailElement.add(ee0);
         EmailElement ee1 = new EmailElement();
         ee1.setFrom("Deepak Thapa");
         ee1.setSubject("Staff meeting @Sunday");
         emailElement.add(ee1);
         Thread.sleep(5000);
     }catch(Exception ex){

     }
     runOnUiThread(returnRes);
 }
 @Override
 public boolean onCreateOptionsMenu(Menu menu){
       MenuInflater menuInflater = getMenuInflater();
       menuInflater.inflate(R.menu.inbox_menu, menu);
       return true;
   }
 @Override
  public boolean onOptionsItemSelected(MenuItem item){
       switch(item.getItemId()){
       case R.id.inboxEdit:
               Intent intent = new Intent(this,EmailClient.class);
               intent.putExtra("tabId", 2);
               intent.putExtra("EDIT_MODE", 1);
               startActivityForResult(intent, Intent.FILL_IN_DATA);
           return true;
       case R.id.inboxRefresh:
           return true;
       case R.id.inboxNext:
           return true;
       case R.id.inboxPrevious:
           return true;
        }
       return false;
}
private class InboxAdapter extends ArrayAdapter<EmailElement>{
     private ArrayList<EmailElement> items;

     public InboxAdapter(Context context,int textViewResourceId, 
                ArrayList<EmailElement> items) {
        super(context, textViewResourceId, items);
        this.items = items;
    }
      @Override
        public View getView(int position, View convertView, ViewGroup parent) {
                View view = convertView;
                if (view == null) {
                    LayoutInflater vi = (LayoutInflater)getSystemService(Context.LAYOUT_INFLATER_SERVICE);
                    view = vi.inflate(R.layout.inbox_row, null);
                }
                EmailElement o = items.get(position);
                if (o != null) {
                    CheckBox emailCheckBox = (CheckBox)view.findViewById(R.id.inboxCheckBoxId);
                    emailCheckBox.setVisibility(View.INVISIBLE);
                        emailFromTextView = (TextView) view.findViewById(R.id.inboxEmailFrom);
                        emailSubjectTextView = (TextView) view.findViewById(R.id.inboxEmailSubject);
                         if (emailFromTextView != null){
                             emailFromTextView.setText("From: "+o.getFrom());
                        }
                        if(emailSubjectTextView != null){
                            emailSubjectTextView.setText("Sub: ["+ o.getSubject()+"]");
                        }
                }
                return view;
        }
 }


private class CheckBoxWithInboxList extends ArrayAdapter<EmailElement>{
 private ArrayList<EmailElement> items;
 public CheckBoxWithInboxList(Context context,int textViewResourceId, 
            ArrayList<EmailElement> items) {
    super(context, textViewResourceId, items);
    this.items = items;
}
 @Override
 public View getView(int position, View convertView, ViewGroup parent) {
         View view = convertView;
         if (view == null) {
             LayoutInflater vi = (LayoutInflater)getSystemService(Context.LAYOUT_INFLATER_SERVICE);
             view = vi.inflate(R.layout.inbox_row, null);
         }
         EmailElement o = items.get(position);
         if (o != null) {
            CheckBox emailCheckBox = (CheckBox)view.findViewById(R.id.inboxCheckBoxId);
            emailCheckBox.setVisibility(View.VISIBLE);
                emailFromTextView = (TextView) view.findViewById(R.id.inboxEmailFrom);
                 emailSubjectTextView = (TextView) view.findViewById(R.id.inboxEmailSubject);
                  if (emailFromTextView != null){
                     emailFromTextView.setText("From: "+o.getFrom());
                 }
                 if(emailSubjectTextView != null){
                    emailSubjectTextView.setText("Sub: ["+ o.getSubject()+"]");
                 }
         }
         return view;
 }

}
}

  • 1 1 Answer
  • 1 View
  • 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-05-23T14:45:25+00:00Added an answer on May 23, 2026 at 2:45 pm

    For tablayout I recommend : http://developer.android.com/resources/tutorials/views/hello-tabwidget.html

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have started learning Data Mining and wish to create a small project in
I stack with this, I'm trying to create application using TabLayout. I have 3
I wish to create an ASP.NET web application that allows upload of files up
i wish to create a multiplayer game facebook app. a game will have 1
I wish to create an app, which would change the wallpaper of the Android
I wish to create then periodically replace content in a concrete5 CMS. I have
I wish to create ( std::getline() ) and manipulate UTF-16 strings in the Android
Hi I wish to create dynamic file view gallery images but I have no
Hi I have created one gallery..I wish to create folder in my gallery. so,
I wish to create a diagram similar to VS.NET class diagram. I have seen

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.