Android 프로그래밍을 시작합니다. 나는 온도 변환기에 대한 거친 GUI를 만들었지 만, 내 앱을 실행할 때 무엇이 잘못 되었는가를 결정하기가 어렵다. & 어떤 점이 프로그램이 실패했는지 (누가 디버깅 노트를 얼마나 모호하게/괴괴 망게하는지 알고 있는가? Android 에뮬레이터/OS가 실행될 때?).임시 변환기 앱 : 알 수없는 오류로 실패합니다.
Device API 버전은 9 (Android 2.3)입니다.보기를 사용하여 & 레이아웃을 만들려면 XML을 사용하지 말고 프로그래밍 방식으로 수행합니다. 콘솔에서
출력은 에러가 발생했을 때
-Starting 활성 temperatureconv.main.TempMain 장치 에뮬레이터-5554에
-ActivityManager : 출발 : {의도 작용 = android.intent.action.MAIN 고양이 = android.intent.category.LAUNCHER] CMP = temperatureconv.main/.TempMain}
는 8675
생 후 포트 'temperatureconv.main'디버거에 연결 -Attempting
JAR 파일의 C를 찾을 수 없습니다
출처 :의 오류, 일식 다음은 말한다 & "클래스 파일 편집기"를 엽니 다 /..../ android.jar에는 소스 첨부 파일이 없습니다.
당신은 당신이 발생하는 것은 무엇 오류를 생각
아래 소스를 첨부 클릭하여 소스를 첨부 할 수 있습니다? 이 문제를 어떻게 해결할 수 있습니까?
내 코드 : package temperatureconv.main;
import android.app.Activity;
import android.graphics.Color;
import android.os.Bundle;
import android.view.ViewGroup.LayoutParams;
import android.widget.LinearLayout;
import android.widget.TextView;
public class TempMain extends Activity
{
/// Class Variables:
private LinearLayout layout;
/// Class Methods:
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
initComponents();
setContentView(layout); // is this the correct way to set the main panel/view (remember I am not using the XML layout way)?
// Can I use System.out.println(); in a google app, or will that crash it?
// coz I get some funny errors when I do use it.
}
/**
* Create & initialise all application components
*
* @return True if the application components & facade were successfully created
*/
public boolean initComponents()
{
layout = new LinearLayout(this);
TextView celLbl = new TextView(this);
TextView fahLbl = new TextView(this);
TextView celTxt = new TextView(this);
TextView fahTxt = new TextView(this);
// Set Component data
celLbl.setText("Celsius: ");
fahLbl.setText("Fahrenheit: ");
celTxt.setText("0");
fahTxt.setText("32");
layout.setBackgroundColor(Color.BLUE);
celTxt.setBackgroundColor(Color.WHITE);
fahTxt.setBackgroundColor(Color.WHITE);
layout.addView(celLbl);
layout.addView(fahLbl);
layout.addView(celTxt);
layout.addView(fahTxt);
celLbl.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
fahLbl.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
celTxt.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
fahTxt.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
return true;
}
}
작업대에서 프로젝트를 시작할 때 Android 프로젝트를 만들었습니까? –
예, 나는 안드로이드 프로젝트를 올바르게 만들었고 웹 사이트에서 hello world 튜토리얼을 만드는 데 사용 된 것과 동일한 지침을 따랐습니다. – user593747
... 그리고 더 많은 정보. 레이아웃 매개 변수 (이 줄을 편집)를 설정하지 않으면 프로그램이 실행됩니다. 잘못된 유형의 LayoutParams 객체를 가져오고 있습니까? – user593747