Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
getSupportActionBar() is always return null!Please Help
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  6 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
johnson_z  
View profile  
 More options Sep 11 2012, 10:32 pm
From: johnson_z <zhangjianxin0...@gmail.com>
Date: Tue, 11 Sep 2012 19:32:27 -0700 (PDT)
Local: Tues, Sep 11 2012 10:32 pm
Subject: getSupportActionBar() is always return null!Please Help

@Override
protected void onCreate(Bundle savedInstanceState) {
setTheme(R.style.Theme_Sherlock);
super.onCreate(savedInstanceState);
setContentView(R.layout.rc_hd_main);

Resources res = getResources();
TabHost tabHost = (TabHost) findViewById(android.R.id.tabhost);
LocalActivityManager lam = new LocalActivityManager(this, false);
lam.dispatchCreate(savedInstanceState);
tabHost.setup(lam);
TabHost.TabSpec spec;
spec = tabHost.newTabSpec("favs")
.setIndicator("Favorites",
res.getDrawable(R.drawable.rc_main_menu_sharefile))
.setContent(new Intent().setClass(this, FileTransferMainActivity.class));
tabHost.addTab(spec);

// add tabs to tab host
spec = tabHost.newTabSpec("search")
.setIndicator("Search", res.getDrawable(R.drawable.rc_main_menu_touchpad))
.setContent(new Intent().setClass(this, TouchPadActivity.class));
tabHost.addTab(spec);

spec = tabHost.newTabSpec("lenses")
.setIndicator("Lenses", res.getDrawable(R.drawable.rc_main_menu_ppt))
.setContent(new Intent().setClass(this, PptPatternActivity.class));
tabHost.addTab(spec);

}

I'm trying to use actionbar&viewpager in FileTransferMainActivity.But
getSupportActionBar() is always return null.I can'n move forward with my
app if i won't solve the problem.please help.
Always i had set the application with style :Theme.Sherlock.

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Jonathan Steele  
View profile  
 More options Sep 12 2012, 2:28 am
From: Jonathan Steele <xfsuno...@gmail.com>
Date: Tue, 11 Sep 2012 23:28:30 -0700 (PDT)
Local: Wed, Sep 12 2012 2:28 am
Subject: Re: getSupportActionBar() is always return null!Please Help

What FileTransferMainActivity extends to?


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Jake Wharton  
View profile  
 More options Sep 12 2012, 2:30 am
From: Jake Wharton <jakewhar...@gmail.com>
Date: Tue, 11 Sep 2012 23:29:57 -0700
Local: Wed, Sep 12 2012 2:29 am
Subject: Re: getSupportActionBar() is always return null!Please Help

You cannot use ABS with ActivityGroup and/or LocalActivityManager. Use
fragments if you need logic to be encapsulated around views.

---
Jake Wharton
http://about.me/jakewharton

On Tue, Sep 11, 2012 at 7:32 PM, johnson_z <zhangjianxin0...@gmail.com>wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
张健新  
View profile  
 More options Sep 12 2012, 4:18 am
From: 张健新 <zhangjianxin0...@gmail.com>
Date: Wed, 12 Sep 2012 16:18:24 +0800
Local: Wed, Sep 12 2012 4:18 am
Subject: Re: getSupportActionBar() is always return null!Please Help

First,thanks for your response.
I'm sorry I didn't explain my problem clearly.
FileTransferMainActivity (extends SherlockFragmentActivity) actually
contains three fragments.
My app crashed down in the red color part(Shown below,from
 FileTransferMainActivity).The previous code I send to you is From
MainTabActivity. I can use FileTransferMainActivity with actionbar
separately but i can't use it in the case of adding the
FileTransferMainActivity as one tab of tabhost.Is that I can't use ABS in
such situation.
I am Looking forward to your reply!My English is not good,I hope you can
understand what i write. Thank you.

@Override
protected void onCreate(Bundle paramBundle) {
setTheme(R.style.Theme_Sherlock);
super.onCreate(paramBundle);
setContentView(R.layout.rc_transfer_file_main);
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT);
init();
 }

private void init() {

getSupportActionBar().setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);

getSupportActionBar().setIcon(getResources().getDrawable(R.drawable.rc_main _online));

getSupportActionBar().setTitle(getString(R.string.rc_main_connection_state_ online));

getSupportActionBar().setDisplayShowHomeEnabled(false);

getSupportActionBar().setDisplayUseLogoEnabled(false);

getSupportActionBar().setDisplayShowTitleEnabled(false);

mLayoutInflator = (LayoutInflater)
this.getSystemService(Context.LAYOUT_INFLATER_SERVICE);

mViewPager = (ViewPager) findViewById(R.id.rc_transfer_file_main_pagers);

mMainAdapter = new FileTransferMainAdapter(getSupportActionBar(), this,
mViewPager);

mMainAdapter.addTab(getString(R.string.rc_filetransfer_main_tab_file),
R.drawable.rc_filetransfer_main_tab_file, NewShareFilesFragment.class,
null);

mMainAdapter.addTab(getString(R.string.rc_filetransfer_main_tab_category),
R.drawable.rc_filetransfer_main_tab_category,
NewCategoryFilesFragment.class,
null);

mMainAdapter.addTab(getString(R.string.rc_filetransfer_main_tab_uploadList) ,
R.drawable.rc_filetransfer_main_tab_uploadlist,
NewUploadProgressListFragment.class, null);

mViewPager.setAdapter(mMainAdapter);

 }

2012/9/12 Jake Wharton <jakewhar...@gmail.com>


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
张健新  
View profile  
 More options Sep 12 2012, 4:24 am
From: 张健新 <zhangjianxin0...@gmail.com>
Date: Wed, 12 Sep 2012 16:24:56 +0800
Local: Wed, Sep 12 2012 4:24 am
Subject: Re: getSupportActionBar() is always return null!Please Help

First ,Thanks for your response!
 FileTransferMainActivity (extends SherlockFragmentActivity) actually
contains three fragments. I can use FileTransferMainActivity with actionbar
separately but i can't use it in the case of adding the
FileTransferMainActivity as one tab of tabhost.Is that I can't use ABS in
such situation.
I am Looking forward to your reply!My English is not good,I hope you can
understand what i write. Thank you.

2012/9/12 Jonathan Steele <xfsuno...@gmail.com>


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Abdul Aleem Mohammed  
View profile  
 More options Nov 7 2012, 2:52 pm
From: Abdul Aleem Mohammed <abdul.imr...@gmail.com>
Date: Wed, 7 Nov 2012 11:52:04 -0800 (PST)
Local: Wed, Nov 7 2012 2:52 pm
Subject: Re: getSupportActionBar() is always return null!Please Help

Hi Jake,

I m trying to use ActionBarSherlock in my application. I m using
ActivityGroups for my tabs and i want to show actionBar for one fo the
activity in tabs. I m able to to display menus but whenever i
call getSupportActionBar().setNavigationMode(getSupportActionBar().NAVIGATION_MO DE_LIST);
i m getting Null pointer exception.

Any help will be appreciated.

Thanks

Regards
Abdul


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »