English 中文(简体)
icon在内部点击时更新方言箱的内容 名单
原标题:update dialog box s content when icon is click inside ListView

当点击<密码>ListView内的icon时,我试图开辩。 方言是,其中载有几个<编码>TextViews,其中显示根据被点击的清单所列信息。 每个清单 项目在被点击时,将在方言箱内显示不同的信息。

问题在于,如果点击icon,即点叫showDialog(INFO_DIALOG_ENYTY);和方言中的案文只有在CreateDialog内部形成方言时才能更新。

But I want to update TextView s contect which is inside dialog every time i click on List Item icon.

或者如果其他人有另一个选择使用而不是方言,那么,作为我的灵魂,请在把icon点击列入名单时显示信息。

问题回答

如果案件不是无效,则在点击事件检查时,采用<代码>showdialog(0)方法,将案文打上,显示方言。 如果案件没有取消,那么就会产生辩证。

See the sample example

import android.app.Activity;
import android.app.AlertDialog;
import android.app.AlertDialog.Builder;
import android.content.DialogInterface;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.TextView;

public class MainActivity extends Activity {
    int counter = 0;

    Builder myAlertDialog;
    View entryView;
    TextView dialogTextview;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

        Button b = (Button) findViewById(R.id.button1);
        b.setOnClickListener(listener);

    }

    public OnClickListener listener = new OnClickListener() {
        @Override
        public void onClick(View arg0) {

            ++counter;
            startDialog("Clicked=" + counter);

        }

    };

    private void startDialog(String message) {
        LayoutInflater factory = LayoutInflater.from(this);
        entryView = factory.inflate(R.layout.mytest, null);
        dialogTextview = (TextView) entryView.findViewById(R.id.textview1);
        if (myAlertDialog == null) {
            myAlertDialog = new AlertDialog.Builder(this);
            myAlertDialog.setView(entryView);

            myAlertDialog.setMessage("Do you want to exit the application?");
            myAlertDialog.setPositiveButton("Yes",
                    new DialogInterface.OnClickListener() {

                        // do something when the button is clicked
                        public void onClick(DialogInterface arg0, int arg1) {
                            System.out.println("...yes button is clicked..");
                            arg0.dismiss();

                        }
                    });

            myAlertDialog.setNegativeButton("NO",
                    new DialogInterface.OnClickListener() {

                        // do something when the button is clicked
                        public void onClick(DialogInterface arg0, int arg1) {
                            System.out.println("...clicked no...");
                            arg0.dismiss();
                        }
                    });
            AlertDialog alert = myAlertDialog.create();

            alert.getWindow().setLayout(600, 400);

            myAlertDialog.show();
        } else {
            dialogTextview.setText(message);
            System.out.println("...settext in dialog...");
            myAlertDialog.setView(entryView);
            myAlertDialog.show();
        }
    }

}




相关问题
Android - ListView fling gesture triggers context menu

I m relatively new to Android development. I m developing an app with a ListView. I ve followed the info in #1338475 and have my app recognizing the fling gesture, but after the gesture is complete, ...

AsyncTask and error handling on Android

I m converting my code from using Handler to AsyncTask. The latter is great at what it does - asynchronous updates and handling of results in the main UI thread. What s unclear to me is how to handle ...

Android intent filter for a particular file extension?

I want to be able to download a file with a particular extension from the net, and have it passed to my application to deal with it, but I haven t been able to figure out the intent filter. The ...

Android & Web: What is the equivalent style for the web?

I am quite impressed by the workflow I follow when developing Android applications: Define a layout in an xml file and then write all the code in a code-behind style. Is there an equivalent style for ...

TiledLayer equivalent in Android [duplicate]

To draw landscapes, backgrounds with patterns etc, we used TiledLayer in J2ME. Is there an android counterpart for that. Does android provide an option to set such tiled patterns in the layout XML?

Using Repo with Msysgit

When following the Android Open Source Project instructions on installing repo for use with Git, after running the repo init command, I run into this error: /c/Users/Andrew Rabon/bin/repo: line ...

Android "single top" launch mode and onNewIntent method

I read in the Android documentation that by setting my Activity s launchMode property to singleTop OR by adding the FLAG_ACTIVITY_SINGLE_TOP flag to my Intent, that calling startActivity(intent) would ...

From Web Development to Android Development

I have pretty good skills in PHP , Mysql and Javascript for a junior developer. If I wanted to try my hand as Android Development do you think I might find it tough ? Also what new languages would I ...

热门标签