Android:文本未应用于卡

时间:2014-06-08 00:09:59

标签: android

所以我正在尝试创建一个应用程序,用户将在两个edittext字段中输入一些文本,当按下提交按钮时,它将关闭编辑窗口,然后将新卡添加到主要列表中活动。我已经设置了所有代码,一切正常,但没有错误。但是,没有添加任何卡,当应用程序启动时,有一张卡在任何地方都没有文本。

我的代码:

MainActivity.java:

//The following lines of code are in onCreate() and setContentView() has been
//called

//Get the intent that launched the activity
Intent i = getIntent();

//Get the strings from the intent
String sig = i.getStringExtra("signature");
String lMessage = i.getStringExtra("long_message");

//Init mCardView
mCardView = (CardUI) findViewById(R.id.cardsview);

//Allow swipe to delete for cards
mCardView.setSwipeable(true);

//Add new card with the two extra strings from the edit text fields
mCardView.addCard(new MyCard(sig, lMessage));

//Draw the cards
mCardView.refresh();

AddText.java

//The following lines of code are in onCreate() and setContentView() has been
//called

//Find edit text's and button
EditText name = (EditText) findViewById(R.id.enter_name);
EditText message = (EditText) findViewById(R.id.enter_message);
button = (Button) findViewById(R.id.add_signature);

//Get the string from the edit text...whatever it may be.
final String signature = name.getText().toString();
final String longMessage = message.getText().toString();

button.setOnClickListener(new View.OnClickListener() {
    @Override
    public void onClick(View v) {
        //Make a new intent to start main activity
        Intent intent = new Intent(getApplication(), YearbookMain.class); 

        //Put extras into intent
        intent.putExtra("signature", signature);
        intent.putExtra("long_message", longMessage);

        //Start intent
        startActivity(intent);
    }
});

同样,我没有得到任何崩溃,只是卡片没有被编辑。我已经尝试了所有我能想到的东西,所以我希望有人能想到别的东西!

由于

0 个答案:

没有答案