有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

java如何让onClickListener从另一个活动接收意图信息

我试图让一个按钮使用另一个活动中的一些数据,我做了搜索,但我没有找到方法

监听器不工作。 以下是我的onCreate中的代码:

super.onCreate(savedInstanceState);
        setContentView(R.layout.show_message);

        Intent intent = getIntent();
        String msg = intent.getStringExtra("MESSAGE");
        ScrollTextView scrolltext = (ScrollTextView) findViewById(R.id.scroll_text);
        scrolltext.setText(msg);
        scrolltext.setTextSize(220);
        scrolltext.startScroll();

        super.onResume();


        DialogFragment mDialog = new GeneralDialogFragment();
        mDialog.show(getSupportFragmentManager(), "Dialog TAG");

        ImageButton mImageButton = (ImageButton)findViewById(R.id.image_button);
        mImageButton.setOnClickListener(new View.OnClickListener(){
            @Override
            public void onClick(View v){
                //I'm sure this is not the to make this button works. What code should I put here to pass this data to the ScrollTextView?
                scrolltext.setText(msg);
                scrolltext.setTextSize(220);
                scrolltext.startScroll();

            }
        });

共 (0) 个答案