ActionBarSherlock と Facebook SDK 3.0.2 を使用するアプリがあります。ActionBarSherlock をインポートしてアプリに実装した後、これらの問題が発生しました。まず、android_support_v4 ライブラリが競合しました。次に、それを削除して、jar ファイルを 1 つだけ指定しました。私のアプリがインストールされました。次に、アプリが ABS を含む MainActivity を実行すると、アプリが強制終了し、エラーが発生しました: java.lang.NoClassDefFoundError: android.support.v4.app.FragmentActivity
ここでの問題は何ですか:
package vn.com.onesoft.bigvl.main.activity;
import java.util.ArrayList;
import vn.bigone.main.MainActivity;
import vn.com.onesoft.bigvl.R;
import vn.com.onesoft.bigvl.chat.ChatActivity;
import vn.com.onesoft.bigvl.context.GameContext;
import vn.com.onesoft.bigvl.gps.GPSTracker;
import vn.com.onesoft.bigvl.main.ui.ActionManager;
import vn.com.onesoft.bigvl.main.ui.BigVLListViewAdapter;
import vn.com.onesoft.bigvl.main.ui.BigVLListViewItem;
import vn.com.onesoft.bigvl.main.ui.IListViewItem;
import vn.com.onesoft.bigvl.message.MessageSender;
import vn.com.onesoft.bigvl.message.out.MGetContactListReq;
import vn.com.onesoft.bigvl.message.out.MVLGetFollowListReq;
import vn.com.onesoft.bigvl.message.out.MVLGetFriendListInMobileContactReq;
import vn.com.onesoft.bigvl.message.out.MVLListGameReq;
import vn.com.onesoft.bigvl.message.out.MVLUpdateLocationReq;
import android.annotation.SuppressLint;
import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.FragmentTransaction;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ListView;
import android.widget.Toast;
import com.actionbarsherlock.app.ActionBar;
import com.actionbarsherlock.app.ActionBar.Tab;
import com.actionbarsherlock.app.SherlockActivity;
@SuppressLint("ShowToast")
public class ActivityMain extends SherlockActivity implements ActionBar.TabListener {
@Override
protected void onResume() {
//
super.onResume();
GameContext.activity = this;
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.bvl_activity_main);
GameContext.activity = this;
this.getSupportActionBar().setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
// TODO tab1
ActionBar.Tab tab1 = getSupportActionBar().newTab();
tab1.setText("Kết nối");
tab1.setIcon(R.drawable.ket_noi);
tab1.setTabListener(this);
getSupportActionBar().addTab(tab1);
// TODO tab2
ActionBar.Tab tab2 = getSupportActionBar().newTab();
tab2.setText("Kết nối");
tab2.setIcon(R.drawable.chat);
tab2.setTabListener(this);
getSupportActionBar().addTab(tab2);
// TODO tab3
ActionBar.Tab tab3 = getSupportActionBar().newTab();
tab3.setText("Kết nối");
tab3.setIcon(R.drawable.game);
tab3.setTabListener(this);
getSupportActionBar().addTab(tab3);
// TODO tab4
ActionBar.Tab tab4 = getSupportActionBar().newTab();
tab4.setText("Kết nối");
tab4.setIcon(R.drawable.blog);
tab4.setTabListener(this);
getSupportActionBar().addTab(tab4);
final ListView listview = (ListView) findViewById(R.id.listViewConnectivityFriends);
listview.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view,
int position, long id) {
//
BigVLListViewAdapter lvAdapter = (BigVLListViewAdapter) parent
.getAdapter();
BigVLListViewItem item = (BigVLListViewItem) lvAdapter
.getItem(position);
item.getLvAction().onClick();
}
});
ArrayList<BigVLListViewItem> lvItems = new ArrayList<BigVLListViewItem>();
lvItems.add(new BigVLListViewItem(R.drawable.danh_ba, "Danh bạ",
new IListViewItem() {
@Override
public void onClick() {
MVLGetFriendListInMobileContactReq mobileContactReq = new MVLGetFriendListInMobileContactReq();
MessageSender.sendMessage(mobileContactReq);
}
}));
lvItems.add(new BigVLListViewItem(R.drawable.danh_sach_ban,
"Danh sách bạn", new IListViewItem() {
@Override
public void onClick() {
//
Intent intent = new Intent(GameContext.activity,
MainActivity.class);
GameContext.activity.startActivity(intent);
}
}));
lvItems.add(new BigVLListViewItem(R.drawable.theo_doi_ban,
"Danh sách theo dõi", new IListViewItem() {
@Override
public void onClick() {
// TODO Auto-generated method stub
MVLGetFollowListReq mvlGetFollowListReq = new MVLGetFollowListReq(
0);
MessageSender.sendMessage(mvlGetFollowListReq);
}
}));
lvItems.add(new BigVLListViewItem(R.drawable.ket_noi,
"Yêu cầu kết bạn", new IListViewItem() {
@Override
public void onClick() {
// TODO Auto-generated method stub
}
}));
final ListView listview2 = (ListView) findViewById(R.id.listViewConnectivitySearch);
listview2.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view,
int position, long id) {
//
BigVLListViewAdapter lvAdapter = (BigVLListViewAdapter) parent
.getAdapter();
BigVLListViewItem item = (BigVLListViewItem) lvAdapter
.getItem(position);
item.getLvAction().onClick();
}
});
ArrayList<BigVLListViewItem> lvItem2s = new ArrayList<BigVLListViewItem>();
lvItem2s.add(new BigVLListViewItem(R.drawable.tim_kiem,
"Tìm quanh đây", new IListViewItem() {
@Override
public void onClick() {
GPSTracker gps = new GPSTracker(GameContext.activity);
MVLUpdateLocationReq mvlUpdateLocationReq = new MVLUpdateLocationReq(
gps.getLatitude(), gps.getLongitude());
MessageSender.sendMessage(mvlUpdateLocationReq);
}
}));
listview.setAdapter(new BigVLListViewAdapter(lvItems));
listview2.setAdapter(new BigVLListViewAdapter(lvItem2s));
}
@Override
public void onTabSelected(Tab tab, FragmentTransaction ft) {
// TODO Auto-generated method stub
switch (tab.getPosition()) {
case 0:
ActionManager.showAction(ActionManager.ACTION_KET_NOI);
MGetContactListReq mGetContactListReq = new MGetContactListReq(
0);
MessageSender.sendMessage(mGetContactListReq);
break;
case 1:
ActionManager.showAction(ActionManager.ACTION_CHAT);
Intent intent = new Intent(
GameContext.activity.getApplicationContext(),
ChatActivity.class);
startActivity(intent);
Toast.makeText(GameContext.activity, "Request sent", 1).show();
break;
case 2:
ActionManager.showAction(ActionManager.ACTION_GAMES);
MVLListGameReq mListGameReq = new MVLListGameReq();
MessageSender.sendMessage(mListGameReq);
break;
case 3:
break;
default:
break;
}
}
@Override
public void onTabUnselected(Tab tab, FragmentTransaction ft) {
// TODO Auto-generated method stub
}
@Override
public void onTabReselected(Tab tab, FragmentTransaction ft) {
// TODO Auto-generated method stub
}
}