问题是:视图中有一个按钮。当用户单击该按钮时,会在表中插入一列。我已经阅读了将mysql连接到android的教程,但我仍然无法解决这个问题。我在谷歌搜索但仍然找不到。我希望有解决方案来解决我的问题......
查看主要
<ImageView
android:id="@+id/MAIN_tittle"
android:layout_width="300dp"
android:layout_height="115dp"
android:scaleX="1.2"
android:scaleY="1.2"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:src="@drawable/main_tittle" />
<ImageButton
android:id="@+id/MAIN_play"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:scaleX="0.7"
android:scaleY="0.7"
android:layout_below="@+id/MAIN_tittle"
android:layout_centerHorizontal="true"
android:background="@android:color/transparent"
android:src="@drawable/main_play" />
主要课程
public class MainMenu extends Activity {
ImageButton playButton = (ImageButton) findViewById(R.id.MAIN_play);
ImageButton optionsButton = (ImageButton) findViewById(R.id.MAIN_options);
ImageButton quitButton = (ImageButton) findViewById(R.id.MAIN_quit);
ImageButton facebookButton = (ImageButton) findViewById(R.id.MAIN_facebook);
ImageButton twitterButton = (ImageButton) findViewById(R.id.MAIN_twitter);
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main_menu);
//PROBLEM IN MANIFEST
play();
options();
quit();
goToFacebook();
rating();
}
private void play() {
playButton.setOnClickListener( new View.OnClickListener() {
public void onClick(View v)
{ startActivity(new Intent("com.example.creativesnakeladder.CharactersChoice"));
//this is area of codes which to insert a column in mysql database
}
});
}