android - Error:(44, 5) error: method does not override or implement a method from a supertype -
indefinite.java main code , there someproblem code.any appreciated.
package mycompanycom.indefinite; import android.content.intent; import android.support.v7.app.actionbaractivity; import android.os.bundle; import android.support.v7.app.appcompatactivity; import android.view.menu; import android.view.menuitem; import android.view.view; import android.widget.button; import android.widget.edittext; import android.widget.relativelayout; public class indefinite extends actionbaractivity { @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_indefinite); } @override public boolean oncreateoptionsmenu(menu menu) { // inflate menu; adds items action bar if present. getmenuinflater().inflate(r.menu.menu_indefinite, menu); return true; } @override public boolean onoptionsitemselected(menuitem item) { // handle action bar item clicks here. action bar // automatically handle clicks on home/up button, long // specify parent activity in androidmanifest.xml. int id = item.getitemid(); //noinspection simplifiableifstatement if (id == r.id.action_settings) { return true; } return super.onoptionsitemselected(item); } @override public void onclick(view view) { intent intent=new intent(this,displaymessageactivity.class); startactivity(intent); } }
this xml first project.
activity_indefinite.xml
<relativelayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="wrap_content" android:paddingleft="@dimen/activity_horizontal_margin" android:paddingright="@dimen/activity_horizontal_margin" android:paddingtop="@dimen/activity_vertical_margin" android:paddingbottom="@dimen/activity_vertical_margin" tools:context=".indefinite"> <button android:id="@+id/the_button" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/indefinite" android:onclick="onclick" android:layout_alignparenttop="true" android:layout_centerhorizontal="true" /> <imageview android:layout_width="wrap_content" android:layout_height="wrap_content" android:tint="#55ff0000" android:src="@drawable/images" android:layout_below="@+id/the_button" android:layout_centerhorizontal="true" android:layout_margintop="85dp" /> </relativelayout>
this second activity code programmatically written
displaymessageactivity.java
package mycompanycom.indefinite; import android.support.v7.app.actionbaractivity; import android.os.bundle; import android.support.v7.app.appcompatactivity; import android.view.menu; import android.view.menuitem; public class displaymessageactivity extends appcompatactivity { @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_display_message); } @override public boolean onoptionsitemselected(menuitem item) { // handle action bar item clicks here. action bar // automatically handle clicks on home/up button, long // specify parent activity in androidmanifest.xml. int id = item.getitemid(); //noinspection simplifiableifstatement if (id == r.id.action_settings) { return true; } return super.onoptionsitemselected(item); } }
in second activity have written getintent() accept intent.
public void onclick(view view)
part of view.onclicklistener
interface. make app compile have add implements view.onclicklistener
definition of class
Comments
Post a Comment