Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/192.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/456.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 为什么Eclipse错误日志显示错误“未能实例化”_Android - Fatal编程技术网

Android 为什么Eclipse错误日志显示错误“未能实例化”

Android 为什么Eclipse错误日志显示错误“未能实例化”,android,Android,错误日志显示错误org.anddev.android.weatherforecast.view.SingleWeatherInfoView未能实例化 包名称:org.anddev.android.weatherforecast.view 类名:SingleWeatherInfoView 请帮我摆脱这个错误 我的错误日志 发布你的SingleWeatherInfoView.javaNow你可以看到我的源代码你是这个类的startActivity吗?不,亲爱的,我在另一个类中有startActiv

错误日志显示错误org.anddev.android.weatherforecast.view.SingleWeatherInfoView未能实例化

包名称:org.anddev.android.weatherforecast.view

类名:SingleWeatherInfoView

请帮我摆脱这个错误

我的错误日志


发布你的SingleWeatherInfoView.javaNow你可以看到我的源代码你是这个类的startActivity吗?不,亲爱的,我在另一个类中有startActivity当你发布问题mind时,总是在这里发布完整的logcat,它是解锁的钥匙…发布你的SingleWeatherInfoView.javaNow你可以看到我的源代码你是这个类的startActivity吗?不,亲爱的,我在另一个类中有startActivity当你发布问题时,注意,总是在这里发布完整的logcat,它是解锁的钥匙。。。
package org.anddev.android.weatherforecast.views;

import java.io.BufferedInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import java.net.URLConnection;
import java.util.Map;

import org.anddev.android.weatherforecast.R;

import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Typeface;
import android.util.AttributeSet;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

/**
 * The View capable of showing a WeatehrIcon + a Temperature-TextView.
 */
public class SingleWeatherInfoView extends LinearLayout {

    // ===========================================================
    // Fields
    // ===========================================================

    private ImageView myWeatherImageView = null;
    private TextView myTempTextView = null;

    // ===========================================================
    // Constructors
    // ===========================================================

    public SingleWeatherInfoView(Context context) 
    {
        super(context);
    }


    public SingleWeatherInfoView(Context context, AttributeSet attrs) //,Map inflateParams
    {
        super(context,attrs);
        /* Setup the ImageView that will show weather-icon. */
        this.myWeatherImageView = new ImageView(context);
        this.myWeatherImageView.setImageDrawable(getResources().getDrawable(R.drawable.dunno));

        /* Setup the textView that will show the temperature. */
        this.myTempTextView = new TextView(context);
        this.myTempTextView.setText("? °C");
        this.myTempTextView.setTextSize(16);
        this.myTempTextView.setTypeface(Typeface.create("Tahoma", Typeface.BOLD));


        /* Add child views to this object. */
        this.addView(this.myWeatherImageView, new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));

        this.addView(this.myTempTextView, new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
    }

    // ===========================================================
    // Getter & Setter
    // ===========================================================

    public void reset() {
        this.myWeatherImageView.setImageDrawable(getResources().getDrawable(
                R.drawable.dunno));
        this.myTempTextView.setText("? °C");
    }

    /** Sets the Child-ImageView of this to the URL passed. */
    public void setRemoteImage(URL aURL) {
        try {
            URLConnection conn = aURL.openConnection();
            conn.connect();
            InputStream is = conn.getInputStream();
            BufferedInputStream bis = new BufferedInputStream(is);
            Bitmap bm = BitmapFactory.decodeStream(bis);
            bis.close();
            is.close();
            this.myWeatherImageView.setImageBitmap(bm);
        } catch (IOException e) {
            /* Reset to 'Dunno' on any error. */
            this.myWeatherImageView.setImageDrawable(getResources()
                    .getDrawable(R.drawable.dunno));
        }
    }

    public void setTempCelcius(int aTemp) {
        this.myTempTextView.setText("" + aTemp + " °C");
    }

    public void setTempFahrenheit(int aTemp) {
        this.myTempTextView.setText("" + aTemp + " °F");
    }

    public void setTempFahrenheitMinMax(int aMinTemp, int aMaxTemp) {
        this.myTempTextView.setText("" + aMinTemp + "/" + aMaxTemp + " °F");
    }

    public void setTempCelciusMinMax(int aMinTemp, int aMaxTemp) {
        this.myTempTextView.setText("" + aMinTemp + "/" + aMaxTemp + " °C");
    }

    public void setTempString(String aTempString) {
        this.myTempTextView.setText(aTempString);
    }
}