久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

OnClick 偵聽器未按預期運行

OnClick Listener Is Not Function As Expected(OnClick 偵聽器未按預期運行)
本文介紹了OnClick 偵聽器未按預期運行的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

我在 TextView (mReadAgainButton) 上設置了一個 onClickListener,它應該從頭開始重新加載一組指令(最初顯示通過 Button 上的 onClickListener 調用 mAssistUpdateButton) 但是當點擊 TextView mReadAgainButton 似乎什么也沒發生.

I have an onClickListener set on a TextView (mReadAgainButton) which is supposed to reload a set of instructions from the beginning (initially displayed via an onClickListener on a Button called mAssistUpdateButton) however when clicking on the TextView mReadAgainButton nothing seems to happen.

public void onClick(View v) {
        if (v == mAssistUpdateButton) {

            // Update button for ICS and up is selected
            // Get the TextView in the Assist Update UI

            TextView tv = (TextView) findViewById(R.id.apn_app_text_cta2);
            String text = "";
            CharSequence styledText = text;
            switch (mInstructionNumber) {

            case 0:
                // Retrieve the instruction string resource corresponding the
                // 2nd set of instructions
                text =   String.format(getString(R.string.apn_app_text_instr),
                        TotalSteps);
                styledText = Html.fromHtml(text);
                // Update the TextView with the correct set of instructions
                tv.setText(styledText);
                // Increment instruction number so the correct instructions
                // string resource can be retrieve the next time the update
                // button is pressed
                mInstructionNumber++;
                break;
            case 1:
                text = getString(R.string.apn_app_text_instr2);
                styledText = Html.fromHtml(text);
                tv.setText(styledText);
                // Increment instruction number so the correct instructions
                // string resource can be retrieve the next time the update
                // button is pressed
                mInstructionNumber++;
                break;
            case 2:
                // Final set of instructions-Change to the corresponding layout

                setContentView(R.layout.assist_instructions);
                String assistUpdateInstr = String.format(
                        getString(R.string.apn_app_text_instr3), TotalSteps);
                styledText = Html.fromHtml(assistUpdateInstr);
                TextView assistInstrText = (TextView) findViewById(R.id.updated_text);
                assistInstrText.setText(styledText);
                mAssistInstrButton = (Button) findViewById(R.id.assist_instr_btn);
                mAssistInstrButton.setOnClickListener(this);
                mReadAgainButton = (TextView) findViewById(R.id.read_again_btn);
                mReadAgainButton.setOnClickListener(this);
            }
        } else if (v == mAssistInstrButton) {
            // "LET'S DO THIS" Button in final instructions screen for ICS and
            // up is selected
            Values = getValues();
            startActivity(new Intent(Settings.ACTION_APN_SETTINGS));
            try {
                showNotification();
            } catch (SAXException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            } catch (ParserConfigurationException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
            finish();
        } else if (v == mAssistInstrButton) {
            startActivity(new Intent(Settings.ACTION_APN_SETTINGS));
            try {
                showNotification();
            } catch (SAXException e1) {
                // TODO Auto-generated catch block
                e1.printStackTrace();
            } catch (ParserConfigurationException e1) {
                // TODO Auto-generated catch block
                e1.printStackTrace();
            }
            try {
                showNotification();
            } catch (SAXException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            } catch (ParserConfigurationException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
            finish();

        } else if (v == mReadAgainButton) {
            // go back to set of instructions if read again is selected

            TextView tv = (TextView) findViewById(R.id.apn_app_text_cta2);
            String text = "";
            CharSequence styledText = text;
            switch (mInstructionNumber) {

            case 0:
                // Retrieve the instruction string resource corresponding the
                // 2nd set of instructions
                text = String.format(getString(R.string.apn_app_text_instr),
                        TotalSteps);
                styledText = Html.fromHtml(text);
                // Update the TextView with the correct set of instructions
                tv.setText(styledText);
                // Increment instruction number so the correct instructions
                // string resource can be retrieve the next time the update
                // button is pressed
                mInstructionNumber++;
                break;
            case 1:
                text = getString(R.string.apn_app_text_instr2);
                styledText = Html.fromHtml(text);
                tv.setText(styledText);
                // Increment instruction number so the correct instructions
                // string resource can be retrieve the next time the update
                // button is pressed
                mInstructionNumber++;
                break;
            case 2:
                // Final set of instructions-Change to the corresponding layout

                setContentView(R.layout.assist_instructions);
                String assistUpdateInstr = String.format(
                        getString(R.string.apn_app_text_instr3), TotalSteps);
                styledText = Html.fromHtml(assistUpdateInstr);
                TextView assistInstrText = (TextView) findViewById(R.id.updated_text);
                assistInstrText.setText(styledText);
                mAssistInstrButton = (Button) findViewById(R.id.assist_instr_btn);
                mAssistInstrButton.setOnClickListener(this);
                mReadAgainButton = (TextView) findViewById(R.id.read_again_btn);
                mReadAgainButton.setOnClickListener(this);
            }
        }
    }

完整來源:

public class ConfigFinalActivity extends Activity implements OnClickListener {
    private static final String TAG = "ConfigFinalActivity";
    TelephonyManager tm;
    AlertDialog mErrorAlert = null;
    private Notification mNotification = null;
    private Button mXButton = null;
    private ImageView mAssistUpdateButton = null;
    private Button mAssistInstrButton = null;
    private TextView mReadAgainButton = null;
    private int mInstructionNumber = 0;
    public static ArrayList<String> NameArr = new ArrayList<String>();
    public static ArrayList<String> ValueArr = new ArrayList<String>();
    public static ArrayList<String> nameArr = new ArrayList<String>();
    public static ArrayList<String> ApnArr = new ArrayList<String>();
    public static ArrayList<String> mmscArr = new ArrayList<String>();
    public static ArrayList<String> mmsportArr = new ArrayList<String>();
    public static ArrayList<String> mmsproxyArr = new ArrayList<String>();
    public static ArrayList<String> portArr = new ArrayList<String>();
    public static ArrayList<String> proxyArr = new ArrayList<String>();
    public static int count;
    public static int TotalSteps = 10;
    int i, g = 0, result = 0;

    public static ContentValues Values = new ContentValues();

    public static final Uri APN_TABLE_URI = Uri
            .parse("content://telephony/carriers");
    public static InputStream stream = null;
    UpdateActivity update;
    public static String status, queryResult = "";

    /** Called when the activity is first created. */
    @SuppressLint("NewApi")
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        int version = android.os.Build.VERSION.SDK_INT;
        tm = (TelephonyManager) getSystemService(TELEPHONY_SERVICE);
        update = new UpdateActivity();
        getArrayLists();

        if (ApnArr.isEmpty() || mmscArr.isEmpty()) {

            tryagain();
        } else if (version < VERSION_CODES.ICE_CREAM_SANDWICH) {

            SettingsDbAdapter.setArrayLists(nameArr, ApnArr, mmscArr,
                    mmsproxyArr, mmsportArr, proxyArr, portArr, count,
                    ConfigFinalActivity.this);
            // Update APN table
            try {
                result = updateTable();
            } catch (IOException e1) {
                // TODO Auto-generated catch block
                e1.printStackTrace();
            }// Settings updated with this atomic call
            catch (SAXException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            } catch (ParserConfigurationException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }

            if (result != -1) {
                status = "success";

            } else {
                status = "failure";
            }

            if (status.equals("success")) {
                completeUpdate();
            } else if (status.equals("failure")) {
                tryagain();

            }

        } else {// ICS and later versions

            // Reduce number of steps to 10
            TotalSteps = 10;
            setContentView(R.layout.assist_update);
            String assistUpdate = getString(R.string.instructions_1);
            mAssistUpdateButton = (ImageView) findViewById(R.id.assist_update_btn);
            mAssistUpdateButton.setOnClickListener(this);

        }
    }

    private void getArrayLists() {
        nameArr = update.getnameArr();
        ApnArr = update.getApnArr();
        mmscArr = update.getMMSCArr();
        mmsproxyArr = update.getMmscProxyArr();
        mmsportArr = update.getMmsPortArr();
        proxyArr = update.getProxyArr();
        portArr = update.getPortArr();
        count = update.getCount();
        queryResult = update.getResult();
    }

    public void onClick(View v) {
        switch (v.getId()) {
        case R.id.assist_update_btn:
            switch (mInstructionNumber) {

            }
            // public void onClick(View v) {
            // if (v == mAssistUpdateButton) {

            // Update button for ICS and up is selected
            // Get the TextView in the Assist Update UI

            TextView tv = (TextView) findViewById(R.id.apn_app_text_cta2);
            String text = "";
            CharSequence styledText = text;
            switch (mInstructionNumber) {

            case 0:
                // Retrieve the instruction string resource corresponding the
                // 2nd set of instructions
                text = String.format(getString(R.string.apn_app_text_instr),
                        TotalSteps);
                styledText = Html.fromHtml(text);
                // Update the TextView with the correct set of instructions
                tv.setText(styledText);
                // Increment instruction number so the correct instructions
                // string resource can be retrieve the next time the update
                // button is pressed
                mInstructionNumber++;
                break;
            case 1:
                text = getString(R.string.apn_app_text_instr2);
                styledText = Html.fromHtml(text);
                tv.setText(styledText);
                // Increment instruction number so the correct instructions
                // string resource can be retrieve the next time the update
                // button is pressed
                mInstructionNumber++;
                break;
            case 2:
                // Final set of instructions-Change to the corresponding layout

                setContentView(R.layout.assist_instructions);
                String assistUpdateInstr = String.format(
                        getString(R.string.apn_app_text_instr3), TotalSteps);
                styledText = Html.fromHtml(assistUpdateInstr);
                TextView assistInstrText = (TextView) findViewById(R.id.updated_text);
                assistInstrText.setText(styledText);
                mAssistInstrButton = (Button) findViewById(R.id.assist_instr_btn);
                mAssistInstrButton.setOnClickListener(this);
                mReadAgainButton = (TextView) findViewById(R.id.read_again_btn);
                mReadAgainButton.setOnClickListener(this);
            }
        /
                
【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

相關文檔推薦

How to wrap text around components in a JTextPane?(如何在 JTextPane 中的組件周圍環繞文本?)
MyBatis, how to get the auto generated key of an insert? [MySql](MyBatis,如何獲取插入的自動生成密鑰?[MySql])
Inserting to Oracle Nested Table in Java(在 Java 中插入 Oracle 嵌套表)
Java: How to insert CLOB into oracle database(Java:如何將 CLOB 插入 oracle 數據庫)
Why does Spring-data-jdbc not save my Car object?(為什么 Spring-data-jdbc 不保存我的 Car 對象?)
Use threading to process file chunk by chunk(使用線程逐塊處理文件)
主站蜘蛛池模板: 午夜电影在线播放 | 免费国产视频 | 欧美一级黄色片 | 国产精品久久国产精品 | 亚洲欧美日韩久久 | 亚洲www啪成人一区二区麻豆 | 成人激情视频免费在线观看 | 日韩在线成人 | 夜夜草av| 亚洲一区 中文字幕 | 欧美国产精品 | 亚洲免费三级 | 毛片入口 | 国产精品无码专区在线观看 | 久久99精品国产99久久6男男 | 欧美日韩在线一区二区 | 在线视频一区二区 | 欧美成人一区二区三区 | 天天综合成人网 | 欧美日韩三区 | 日本不卡一区 | 一区二区三 | 国产三级电影网站 | 国产一区三区视频 | 一级做a爰片性色毛片视频停止 | 国产一区二区自拍 | 亚洲网在线 | 精品久久久久久久久久 | 台湾av在线| 丁香婷婷综合激情五月色 | 亚洲1区| xx性欧美肥妇精品久久久久久 | 亚洲欧美日韩精品 | 午夜a√ | 黄色一级大片在线免费看产 | www亚洲免费国内精品 | 成人区精品一区二区婷婷 | 国产精品久久久久久久久久久久久 | 国产成人a亚洲精品 | 亚洲在线一区二区 | 国产丝袜一区二区三区免费视频 |