我正在使用eclipse开发一个Web应用程序.就在今天,我通过更改JAR文件更新了我的struts版本.我正在某些地方收到警告,方法已被弃用,但代码工作正常.
我想知道一些事情
在Java中使用Deprecated方法或类是错误的吗?
如果我不更改任何方法并使用我的警告运行我的应用程序,它会产生任何性能问题.
我很擅长使用Fragments.
我只是想构建一个使用Fragments的简单示例应用程序.我的方案是,我有两个活动,每个活动中有一个片段.第一个片段有一个edittext和一个按钮.第二个片段有一个textview.当我在edittext中输入名称并单击按钮时,第二个片段中的textview应显示在第一个片段的edittext中输入的名称.
我能够将第一个片段的值发送到它的活动,然后从该活动发送到第二个活动.现在我如何在第二个片段中使用此值.
这是Java代码:::
package com.example.fragmentexample;
import android.app.Activity;
import android.app.Fragment;
import android.app.FragmentManager;
import android.content.Intent;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
public class Fragment_1 extends Fragment{
OnFragmentChangedListener mCallback;
// Container Activity must implement this interface
public interface OnFragmentChangedListener {
public void onButtonClicked(String name);
}
@Override
public void onAttach(Activity activity) {
super.onAttach(activity);
// This makes sure that the container activity has implemented
// the callback interface. If not, it throws an exception …Run Code Online (Sandbox Code Playgroud)