Гость
Форумы / Android [игнор отключен] [закрыт для гостей] / Почему виден класс ресурсов? / 3 сообщений из 3, страница 1 из 1
10.01.2014, 13:19
    #38521823
Beduin
Участник
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Почему виден класс ресурсов?
Скорее всего вопрос по java, но все равно прошу помощи. За счет чего компилятор java видит класс ресурсов R.

package com.example.p0081_viewbyid;

import android.app.Activity;
import android.os.Bundle;
import android.view.Menu;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.TextView;

public class MainActivity extends Activity {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
TextView myTextView = (TextView) findViewById(R.id.myText);
myTextView.setText("Вот такая херня");
Button myBtn = (Button) findViewById(R.id.myBtn);
myBtn.setText("Моя кнопка");
myBtn.setEnabled(false);
CheckBox myChb = (CheckBox) findViewById(R.id.myChb);
myChb.setChecked(true);
}

@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.activity_main, menu);
return true;
}

}
...
Рейтинг: 0 / 0
10.01.2014, 13:52
    #38521877
wadman
Участник
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Почему виден класс ресурсов?
автор R is a class containing the definitions for all resources of a particular application package. It is in the namespace of the application package -- that is if you say in your manifest your package name is "com.foo.bar", an R class is generated with the symbols of all your resources in com.foo.bar.R.

There are generally two R classes you will deal with -- the framework resources in android.R and your own in your namespace.

It is named R because that stands for Resources and there is no point in making people type something longer, especially since it is common to end up with fairly long symbol names after it that can cause a fair amount of line wrapper.

Автогенерируемый класс.
...
Рейтинг: 0 / 0
10.01.2014, 13:56
    #38521889
Beduin
Участник
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Почему виден класс ресурсов?
wadmanавтор R is a class containing the definitions for all resources of a particular application package. It is in the namespace of the application package -- that is if you say in your manifest your package name is "com.foo.bar", an R class is generated with the symbols of all your resources in com.foo.bar.R.

There are generally two R classes you will deal with -- the framework resources in android.R and your own in your namespace.

It is named R because that stands for Resources and there is no point in making people type something longer, especially since it is common to end up with fairly long symbol names after it that can cause a fair amount of line wrapper.

Автогенерируемый класс.
А понял. Общее пространство имен при объявлении классов. package com.example.p0081_viewbyid;
Правильно?
...
Рейтинг: 0 / 0
Форумы / Android [игнор отключен] [закрыт для гостей] / Почему виден класс ресурсов? / 3 сообщений из 3, страница 1 из 1
Целевая тема:
Создать новую тему:
Автор:
Найденые пользователи ...
Разблокировать пользователей ...
Читали форум (0):
Пользователи онлайн (0):
x
x
Закрыть


Просмотр
0 / 0
Close
Debug Console [Select Text]