package com.example.android.favoritetoys;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
public class MainActivity extends AppCompatActivity {
// TODO (1) Declare a TextView variable called mToysListTextView
TextView mToysListTextView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mToysListTextView = (TextView).findViewById(R.id.tv_toy_names);
// TODO (3) Use findViewById to get a reference to the TextView from the layout
// TODO (4) Use the static ToyBox.getToyNames method and store the names in a String array
String[] toyNames = ToyBox.getToyNames();
// TODO (5) Loop through each toy and append the name to the TextView (add \n for spacing)
for (String toyName : toyNames) {
mToysListTextView.append(toyName + "\n\n\n");
}
0
A
ответ
0
вам нужно импортировать последний класс, просто добавь
import android.widget.TextView;
1
Перейдите в файл build.gradle. там вы найдете код, указанный ниже
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion '25.0.2'
defaultConfig {
applicationId "com.android.example.favoritetoys"
minSdkVersion 10
targetSdkVersion 25
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:25.1.0'
}
Вы должны сделать просто изменить его buildToolsVersion '25 .0.2' согласно вашей „инструмент для сборки версии“. шахта работает с прочный текст buildToolsVersion '25 .0.1 '