Android 为什么会出现这个错误&引用;标记“”上的语法错误;实现“,@“预期”;
我在实现时遇到了一个错误。错误显示为“令牌上的语法错误”实现“,@expected”。为什么会出现此错误?如何修复此错误 既然我是android新手,那么implementation关键字做什么呢Android 为什么会出现这个错误&引用;标记“”上的语法错误;实现“,@“预期”;,android,error-handling,implementation,Android,Error Handling,Implementation,我在实现时遇到了一个错误。错误显示为“令牌上的语法错误”实现“,@expected”。为什么会出现此错误?如何修复此错误 既然我是android新手,那么implementation关键字做什么呢 package com.fortuna.cinemalk; import android.app.Activity; import android.os.Bundle; import android.support.v4.app.Fragment; import android.support.v4
package com.fortuna.cinemalk;
import android.app.Activity;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentTransaction;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ImageView;
import com.actionbarsherlock.ActionBarSherlock.Implementation;
import com.actionbarsherlock.app.ActionBar;
import com.fortuna.cinemalk.service.CommonVariable;
import com.fortuna.cinemalk.service.ScreenSizeIdentifier;
import com.jeremyfeinstein.slidingmenu.lib.SlidingMenu;
import com.jeremyfeinstein.slidingmenu.lib.app.SlidingFragmentActivity;
public class MainActivity extends SlidingFragmentActivity {
implements HeadlinesFragment.OnHeadlineSelectedListener{
public void onArticleSelected(int position) {
// The user selected the headline of an article from the HeadlinesFragment
// Do something here to display that article
NewsFramgment articleFrag = (NewsFramgment)
getSupportFragmentManager().findFragmentById(R.id.list);
if (articleFrag != null) {
System.out.print("no news found");
} else {
// Otherwise, we're in the one-pane layout and must swap frags...
// Create fragment and give it an argument for the selected article
NewsFramgment newFragment = new NewsFramgment();
Bundle args = new Bundle();
args.putInt(NewsFramgment.ARG_POSITION, position);
newFragment.setArguments(args);
FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
// Replace whatever is in the fragment_container view with this fragment,
// and add the transaction to the back stack so the user can navigate back
transaction.replace(R.id.content_frame, newFragment);
transaction.addToBackStack(null);
// Commit the transaction
transaction.commit();
}
}
出现语法错误:
public class MainActivity extends SlidingFragmentActivity {
implements HeadlinesFragment.OnHeadlineSelectedListener{
应该是:
public class MainActivity extends SlidingFragmentActivity implements HeadlinesFragment.OnHeadlineSelectedListener{
下次查看catlog并查看导致问题的行号时,这将缩小对语法错误的搜索范围。删除
{
在扩展SlidingFragmentActivity
之后。至于“implementation关键字做什么?”,请阅读