我正在开发一个具有以下四个职业的游戏。
您将专业拖放到您最喜欢的囊中,但专业没有下降,并在日志中显示错误:
I / ViewRootImpl:报告删除结果:false。
下面是代码:
public class Game extends AppCompatActivity {
private String statement[][]=new String[4][100];
public TextView agronomist, aircraftinstrumenttechnician, aircraftMechanic, airlineClerk, animalTechnician, animator, mechanic, hairdresser, butcher, cook;
public TextView baker, painter, barber, bricklayer, anthropologist, instructor, archeologist, architect, historian, photographer, artiste, artist, astrologer,astronomer,athlete,auctioneer, graphicdesigner, auditor, autoelectrician, surveyor, banker, basketmaker;
public TextView beautician, beekeeper, bibliographer, biochemist, biologist, blacksmith, bookkeeper,botanist, broadcaster,captain, diplomat,counsellor,carpenter,cartographer,ceramicist, potter, laboratorytechnician, researcher,nurse , choreographer, commentator,journalist, lawyer,computerengineer,computerprogrammer;
public TextView concreter,confectioner, conservator,chef, bailiff,criminalinvestigator,dancer, dentist,dietician,discjockey,diver,porter,draughtsperson,driller, ecologist,economist,editor;
public TextView electrician,ergonomist,farmer,fashiondesigner,fisherman,fitter, flightattendant,flightengineer,forester, furrier,gardener,geneticist,geographer,geologist,glazier,goldsmith;
public TextView herbalist,host,hotelporter,hydrologist,interpreter,interiordesigner,jeweller,judge,lecturer,mc,mathematician,
meteorologist, metrologist, microbiologist,midwife,miller,miner,model,musician,nanny,nutritionist, paediatrician,palmists,pedicurist, manicurist,pharmacist,philosopher,
physiotherapist,pilot,plumber,producer,soldier, psychiatrist,psychologist, publicnotary, publicrelationsmanager,publisher,merchandiser, referee,registrar, salesrepresentative,scriptwriter,sculptor, securityguard,shoemaker,singer,sociologist,solicitor,songwriter,
soundengineer,speechtherapist, spinner,stateattorney,statistician,stockbroker,mason,tamer,tailor,teller,tutor,upholsterer,usher,waiter,weaver,whaler, woodcarver,zookeeper;
public SoundPool soundPool;
private int snd;
public TextView interest,hobby,flair,passion;
Button reset,stmt;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_game);
agronomist = findViewById(R.id.agronomist);
aircraftinstrumenttechnician = findViewById(R.id.aircraftinstrumenttechnician);
aircraftMechanic = findViewById(R.id.aircraftMechanic);
airlineClerk = findViewById(R.id.airlineClerk);
animalTechnician = findViewById(R.id.animalTechnician);
animator = findViewById(R.id.animator);
archeologist = findViewById(R.id.archeologist);
choreographer = findViewById(R.id.choreographer);
fashiondesigner = findViewById(R.id.fashiondesigner);
stateattorney = findViewById(R.id.stateattorney);
mechanic = findViewById(R.id.mechanic);
butcher = findViewById(R.id.butcher);
painter = findViewById(R.id.painter);
baker = findViewById(R.id.baker);
architect = findViewById(R.id.architect);
barber = findViewById(R.id.barber);
anthropologist = findViewById(R.id.anthropologist);
instructor = findViewById(R.id.instructor);
historian = findViewById(R.id.historian);
photographer = findViewById(R.id.photographer);
artiste = findViewById(R.id.artiste);
artist = findViewById(R.id.artist);
astrologer = findViewById(R.id.astrologer);
astronomer = findViewById(R.id.astronomer);
athlete = findViewById(R.id.athlete);
auctioneer = findViewById(R.id.auctioneer);
graphicdesigner = findViewById(R.id.graphicdesigner);
auditor = findViewById(R.id.auditor);
autoelectrician = findViewById(R.id.auto_electrician);
surveyor = findViewById(R.id.surveyor);
banker = findViewById(R.id.banker);
basketmaker = findViewById(R.id.basket_maker);
beekeeper = findViewById(R.id.beekeeper);
bibliographer = findViewById(R.id.bibliographer);
beautician = findViewById(R.id.beautician);
biochemist = findViewById(R.id.biochemist);
biologist = findViewById(R.id.biologist);
blacksmith = findViewById(R.id.blacksmith);
broadcaster = findViewById(R.id.broadcaster);
botanist = findViewById(R.id.botanist);
captain = findViewById(R.id.captain);
diplomat = findViewById(R.id.diplomat);
counsellor = findViewById(R.id.counsellor);
carpenter = findViewById(R.id.carpenter);
cartographer = findViewById(R.id.cartographer);
ceramicist = findViewById(R.id.ceramicist);
potter = findViewById(R.id.potter);
laboratorytechnician = findViewById(R.id.laboratorytechnician);
researcher = findViewById(R.id.researcher);
nurse = findViewById(R.id.nurse);
commentator = findViewById(R.id.commentator);
journalist = findViewById(R.id.journalist);
lawyer = findViewById(R.id.lawyer);
computerengineer = findViewById(R.id.computerengineer);
computerprogrammer = findViewById(R.id.computerprogrammer);
chef = findViewById(R.id.chef);
confectioner = findViewById(R.id.confectioner);
dancer = findViewById(R.id.dancer);
dentist = findViewById(R.id.dentist);
dietician = findViewById(R.id.dietician);
discjockey = findViewById(R.id.discjockey);
diver = findViewById(R.id.diver);
porter = findViewById(R.id.porter);
draughtsperson = findViewById(R.id.draughtsperson);
ecologist = findViewById(R.id.ecologist);
economist = findViewById(R.id.economist);
editor = findViewById(R.id.editor);
electrician = findViewById(R.id.electrician);
ergonomist = findViewById(R.id.ergonomist);
farmer = findViewById(R.id.farmer);
fisherman = findViewById(R.id.fisherman);
flightengineer = findViewById(R.id.flightengineer);
forester = findViewById(R.id.forester);
furrier = findViewById(R.id.furrier);
gardener = findViewById(R.id.gardener);
geneticist = findViewById(R.id.geneticist);
geographer = findViewById(R.id.geographer);
geologist = findViewById(R.id.geologist);
glazier = findViewById(R.id.glazier);
goldsmith = findViewById(R.id.goldsmith);
herbalist = findViewById(R.id.herbalist);
host = findViewById(R.id.host);
hydrologist = findViewById(R.id.hydrologist);
hydrologist = findViewById(R.id.hydrologist);
interpreter = findViewById(R.id.interpreter);
judge = findViewById(R.id.judge);
lecturer = findViewById(R.id.lecturer);
mc = findViewById(R.id.mc);
mathematician = findViewById(R.id.mathematician);
meteorologist = findViewById(R.id.meteorologist);
metrologist = findViewById(R.id.metrologist);
microbiologist = findViewById(R.id.microbiologist);
midwife = findViewById(R.id.midwife);
miller = findViewById(R.id.miller);
miner = findViewById(R.id.miner);
model = findViewById(R.id.model);
musician = findViewById(R.id.musician);
nanny = findViewById(R.id.nanny);
nutritionist = findViewById(R.id.nutritionist);
paediatrician = findViewById(R.id.paediatrician);
palmists = findViewById(R.id.palmists);
pedicurist = findViewById(R.id.pedicurist);
manicurist = findViewById(R.id.manicurist);
pharmacist = findViewById(R.id.pharmacist);
philosopher = findViewById(R.id.philosopher);
physiotherapist = findViewById(R.id.physiotherapist);
pilot = findViewById(R.id.pilot);
plumber = findViewById(R.id.plumber);
psychiatrist = findViewById(R.id.psychiatrist);
psychologist = findViewById(R.id.psychologist);
publicnotary = findViewById(R.id.publicnotary);
publicrelationsmanager = findViewById(R.id.publicrelationsmanager);
publisher = findViewById(R.id.publisher);
merchandiser = findViewById(R.id.merchandiser);
referee = findViewById(R.id.referee);
scriptwriter = findViewById(R.id.scriptwriter);
salesrepresentative = findViewById(R.id.salesrepresentative);
sculptor = findViewById(R.id.sculptor);
securityguard = findViewById(R.id.securityguard);
shoemaker = findViewById(R.id.shoemaker);
singer = findViewById(R.id.singer);
sociologist = findViewById(R.id.sociologist);
solicitor = findViewById(R.id.solicitor);
songwriter = findViewById(R.id.songwriter);
soundengineer = findViewById(R.id.soundengineer);
speechtherapist = findViewById(R.id.speechtherapist);
spinner = findViewById(R.id.spinner);
stateattorney = findViewById(R.id.stateattorney);
statistician = findViewById(R.id.statistician);
stockbroker = findViewById(R.id.stockbroker);
mason = findViewById(R.id.mason);
tamer = findViewById(R.id.tamer);
tailor = findViewById(R.id.tailor);
teller = findViewById(R.id.teller);
tutor = findViewById(R.id.tutor);
upholsterer = findViewById(R.id.upholsterer);
usher = findViewById(R.id.usher);
waiter = findViewById(R.id.waiter);
weaver = findViewById(R.id.weaver);
whaler = findViewById(R.id.whaler);
woodcarver = findViewById(R.id.woodcarver);
zookeeper = findViewById(R.id.zookeeper);
interest = (TextView) findViewById(R.id.t1);
hobby = (TextView) findViewById(R.id.t2);
flair = (TextView) findViewById(R.id.t3);
passion = (TextView) findViewById(R.id.t4);
reset = (Button) findViewById(R.id.rstbutton);
stmt = (Button) findViewById(R.id.sttmntbutton);
agronomist.setOnLongClickListener(longclickListener);
aircraftinstrumenttechnician.setOnLongClickListener(longclickListener);
aircraftMechanic.setOnLongClickListener(longclickListener);
airlineClerk.setOnLongClickListener(longclickListener);
animalTechnician.setOnLongClickListener(longclickListener);
animator.setOnLongClickListener(longclickListener);
mechanic.setOnLongClickListener(longclickListener);
butcher.setOnLongClickListener(longclickListener);
baker.setOnLongClickListener(longclickListener);
painter.setOnLongClickListener(longclickListener);
barber.setOnLongClickListener(longclickListener);
anthropologist.setOnLongClickListener(longclickListener);
instructor.setOnLongClickListener(longclickListener);
archeologist.setOnLongClickListener(longclickListener);
architect.setOnLongClickListener(longclickListener);
historian.setOnLongClickListener(longclickListener);
artist.setOnLongClickListener(longclickListener);
astrologer.setOnLongClickListener(longclickListener);
astronomer.setOnLongClickListener(longclickListener);
athlete.setOnLongClickListener(longclickListener);
auctioneer.setOnLongClickListener(longclickListener);
auditor.setOnLongClickListener(longclickListener);
autoelectrician.setOnLongClickListener(longclickListener);
surveyor.setOnLongClickListener(longclickListener);
banker.setOnLongClickListener(longclickListener);
basketmaker.setOnLongClickListener(longclickListener);
beautician.setOnLongClickListener(longclickListener);
beekeeper.setOnLongClickListener(longclickListener);
bibliographer.setOnLongClickListener(longclickListener);
biochemist.setOnLongClickListener(longclickListener);
biologist.setOnLongClickListener(longclickListener);
blacksmith.setOnLongClickListener(longclickListener);
botanist.setOnLongClickListener(longclickListener);
broadcaster.setOnLongClickListener(longclickListener);
captain.setOnLongClickListener(longclickListener);
diplomat.setOnLongClickListener(longclickListener);
counsellor.setOnLongClickListener(longclickListener);
carpenter.setOnLongClickListener(longclickListener);
cartographer.setOnLongClickListener(longclickListener);
ceramicist.setOnLongClickListener(longclickListener);
potter.setOnLongClickListener(longclickListener);
laboratorytechnician.setOnLongClickListener(longclickListener);
researcher.setOnLongClickListener(longclickListener);
nurse.setOnLongClickListener(longclickListener);
choreographer.setOnLongClickListener(longclickListener);
commentator.setOnLongClickListener(longclickListener);
journalist.setOnLongClickListener(longclickListener);
lawyer.setOnLongClickListener(longclickListener);
computerengineer.setOnLongClickListener(longclickListener);
computerprogrammer.setOnLongClickListener(longclickListener);
chef.setOnLongClickListener(longclickListener);
dancer.setOnLongClickListener(longclickListener);
dentist.setOnLongClickListener(longclickListener);
dietician.setOnLongClickListener(longclickListener);
discjockey.setOnLongClickListener(longclickListener);
diver.setOnLongClickListener(longclickListener);
porter.setOnLongClickListener(longclickListener);
draughtsperson.setOnLongClickListener(longclickListener);
ecologist.setOnLongClickListener(longclickListener);
economist.setOnLongClickListener(longclickListener);
editor.setOnLongClickListener(longclickListener);
electrician.setOnLongClickListener(longclickListener);
ergonomist.setOnLongClickListener(longclickListener);
farmer.setOnLongClickListener(longclickListener);
fashiondesigner.setOnLongClickListener(longclickListener);
fisherman.setOnLongClickListener(longclickListener);
flightengineer.setOnLongClickListener(longclickListener);
forester.setOnLongClickListener(longclickListener);
furrier.setOnLongClickListener(longclickListener);
gardener.setOnLongClickListener(longclickListener);
geneticist.setOnLongClickListener(longclickListener);
graphicdesigner.setOnLongClickListener(longclickListener);
geographer.setOnLongClickListener(longclickListener);
geologist.setOnLongClickListener(longclickListener);
glazier.setOnLongClickListener(longclickListener);
goldsmith.setOnLongClickListener(longclickListener);
herbalist.setOnLongClickListener(longclickListener);
host.setOnLongClickListener(longclickListener);
hydrologist.setOnLongClickListener(longclickListener);
interpreter.setOnLongClickListener(longclickListener);
judge.setOnLongClickListener(longclickListener);
lecturer.setOnLongClickListener(longclickListener);
mc.setOnLongClickListener(longclickListener);
mathematician.setOnLongClickListener(longclickListener);
meteorologist.setOnLongClickListener(longclickListener);
metrologist.setOnLongClickListener(longclickListener);
microbiologist.setOnLongClickListener(longclickListener);
midwife.setOnLongClickListener(longclickListener);
miller.setOnLongClickListener(longclickListener);
miner.setOnLongClickListener(longclickListener);
model.setOnLongClickListener(longclickListener);
musician.setOnLongClickListener(longclickListener);
nanny.setOnLongClickListener(longclickListener);
nutritionist.setOnLongClickListener(longclickListener);
paediatrician.setOnLongClickListener(longclickListener);
palmists.setOnLongClickListener(longclickListener);
pedicurist.setOnLongClickListener(longclickListener);
manicurist.setOnLongClickListener(longclickListener);
pharmacist.setOnLongClickListener(longclickListener);
philosopher.setOnLongClickListener(longclickListener);
pilot.setOnLongClickListener(longclickListener);
plumber.setOnLongClickListener(longclickListener);
psychiatrist.setOnLongClickListener(longclickListener);
psychologist.setOnLongClickListener(longclickListener);
publicnotary.setOnLongClickListener(longclickListener);
publicrelationsmanager.setOnLongClickListener(longclickListener);
publisher.setOnLongClickListener(longclickListener);
merchandiser.setOnLongClickListener(longclickListener);
referee.setOnLongClickListener(longclickListener);
salesrepresentative.setOnLongClickListener(longclickListener);
scriptwriter.setOnLongClickListener(longclickListener);
sculptor.setOnLongClickListener(longclickListener);
securityguard.setOnLongClickListener(longclickListener);
shoemaker.setOnLongClickListener(longclickListener);
singer.setOnLongClickListener(longclickListener);
sociologist.setOnLongClickListener(longclickListener);
solicitor.setOnLongClickListener(longclickListener);
songwriter.setOnLongClickListener(longclickListener);
soundengineer.setOnLongClickListener(longclickListener);
speechtherapist.setOnLongClickListener(longclickListener);
spinner.setOnLongClickListener(longclickListener);
stateattorney.setOnLongClickListener(longclickListener);
stateattorney.setOnLongClickListener(longclickListener);
statistician.setOnLongClickListener(longclickListener);
stockbroker.setOnLongClickListener(longclickListener);
mason.setOnLongClickListener(longclickListener);
tamer.setOnLongClickListener(longclickListener);
tailor.setOnLongClickListener(longclickListener);
teller.setOnLongClickListener(longclickListener);
tutor.setOnLongClickListener(longclickListener);
upholsterer.setOnLongClickListener(longclickListener);
usher.setOnLongClickListener(longclickListener);
waiter.setOnLongClickListener(longclickListener);
weaver.setOnLongClickListener(longclickListener);
whaler.setOnLongClickListener(longclickListener);
woodcarver.setOnLongClickListener(longclickListener);
zookeeper.setOnLongClickListener(longclickListener);
interest.setOnDragListener(dragListener1);
hobby.setOnDragListener(dragListener2);
flair.setOnDragListener(dragListener3);
passion.setOnDragListener(dragListener4);
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.N){
AudioAttributes audioAttributes = new AudioAttributes.Builder()
.setUsage(AudioAttributes.USAGE_ASSISTANCE_SONIFICATION)
.setContentType(AudioAttributes.CONTENT_TYPE_SONIFICATION)
.build();
soundPool = new SoundPool.Builder()
.setMaxStreams(1)
.setAudioAttributes(audioAttributes)
.build();
}
else
{
soundPool = new SoundPool(6, AudioManager.STREAM_MUSIC,0);
}
snd = soundPool.load(this, R.raw.sound,1);
stmt.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent i = new Intent(Game.this, Statement.class);
interest.setText(interest.getText().toString());
hobby.setText(hobby.getText().toString());
flair.setText(flair.getText().toString());
passion.setText(passion.getText().toString());
i.putExtra("key_string","meer");
Bundle mBundle = new Bundle();
mBundle.putSerializable("key_array_array", statement);
i.putExtras(mBundle);
startActivity(i);
}
});
reset.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent=new Intent(Game.this,Game.class);
startActivity(intent);
finish();
}
});
}
View.OnLongClickListener longclickListener = new View.OnLongClickListener() {
@Override
public boolean onLongClick(View v) {
ClipData clipData = newPlainText("","");
View.DragShadowBuilder myShadowbuilder = new View.DragShadowBuilder(v);
v.startDrag(clipData,myShadowbuilder,v,0);
soundPool.play(snd,1,1,0,0,1);
return true;
}
};
View.OnDragListener dragListener1 = new View.OnDragListener() {
@Override
public boolean onDrag(View v, DragEvent event) {
int dragEvent = event.getAction();
final View view = (View) event.getLocalState();
switch(dragEvent){
case DragEvent.ACTION_DRAG_STARTED:
return true;
case DragEvent.ACTION_DRAG_ENTERED:
if(event.getResult()){
//Toast.makeText(view, "The drop was handled.",Toast.LENGTH_SHORT).show();
}else {
//Toast.makeText(Intent,"The drop did not work.",Toast.LENGTH_SHORT).show();
}
return true;
default:
Log.e("Drag and Drop example","Unknown action type received.");
break;
case DragEvent.ACTION_DRAG_LOCATION:
return true;
case DragEvent.ACTION_DRAG_EXITED:
return true;
case DragEvent.ACTION_DROP:
ClipData.Item item = event.getClipData().getItemAt(0);
String dragData = (String) item.getText();
TextView i = (TextView) view;
return true;
}
return true;
}
};
View.OnDragListener dragListener2 = new View.OnDragListener() {
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
@RequiresApi(api = Build.VERSION_CODES.HONEYCOMB)
@Override
public boolean onDrag(View v, DragEvent event) {
int dragEvent = event.getAction();
final View view = (View) event.getLocalState();
switch(dragEvent){
case DragEvent.ACTION_DRAG_STARTED:
return true;
case DragEvent.ACTION_DRAG_ENTERED:
return true;
case DragEvent.ACTION_DRAG_LOCATION:
return true;
case DragEvent.ACTION_DRAG_EXITED:
return true;
case DragEvent.ACTION_DROP:
ClipData.Item item = event.getClipData().getItemAt(0);
String dragData = (String) item.getText();
TextView i = (TextView) view;
return true;
}
return true;
}
};
View.OnDragListener dragListener3 = new View.OnDragListener() {
@Override
public boolean onDrag(View v, DragEvent event) {
int dragEvent = event.getAction();
final View view = (View) event.getLocalState();
switch(dragEvent){
case DragEvent.ACTION_DRAG_STARTED:
return true;
case DragEvent.ACTION_DRAG_ENTERED:
return true;
case DragEvent.ACTION_DRAG_LOCATION:
return true;
case DragEvent.ACTION_DRAG_EXITED:
return true;
case DragEvent.ACTION_DROP:
ClipData.Item item = event.getClipData().getItemAt(0);
String dragData = (String) item.getText();
TextView i = (TextView) view;
return true;
}
return true;
}
};
View.OnDragListener dragListener4 = new View.OnDragListener() {
@Override
public boolean onDrag(View v, DragEvent event) {
int dragEvent = event.getAction();
final View view = (View) event.getLocalState();
switch(dragEvent){
case DragEvent.ACTION_DRAG_STARTED:
return true;
case DragEvent.ACTION_DRAG_ENTERED:
return true;
case DragEvent.ACTION_DRAG_LOCATION:
return true;
case DragEvent.ACTION_DRAG_EXITED:
return true;
case DragEvent.ACTION_DROP:
ClipData.Item item = event.getClipData().getItemAt(0);
String dragData = (String) item.getText();
TextView i = (TextView) view;
return true;
}
return true;
}
};
private class ChoiceDragListener implements View.OnDragListener{
@Override
public boolean onDrag(View v, DragEvent event)
{
int dragEvent = event.getAction();
final View view = (View) event.getLocalState();
final ImageView img = (ImageView) event.getLocalState();
switch (dragEvent){
case DragEvent.ACTION_DRAG_STARTED:
return true;
case DragEvent.ACTION_DRAG_ENTERED:
return true;
case DragEvent.ACTION_DRAG_LOCATION:
return true;
case DragEvent.ACTION_DRAG_EXITED:
return true;
case DragEvent.ACTION_DROP:
return true;
}
return true;
}
}
@Override
public boolean onCreateOptionsMenu(Menu menu){
getMenuInflater().inflate(R.menu.menu,menu);
return super.onCreateOptionsMenu(menu);
}
@Override
public boolean onOptionsItemSelected(MenuItem item){
if(item.getItemId()==R.id.about){
Intent mnIntent = new Intent(Game.this, About.class);
startActivity(mnIntent);
}
if(item.getItemId()==R.id.howtoplay){
Intent mnIntent = new Intent(Game.this, Howtoplay.class);
startActivity(mnIntent);
}
if(item.getItemId()==R.id.appendix){
Intent mnIntent = new Intent(Game.this, Appendix.class);
startActivity(mnIntent);
}
return super.onOptionsItemSelected(item);
}
@Override
public void onBackPressed(){
Intent i=new Intent(Intent.ACTION_MAIN);
i.addCategory(Intent.CATEGORY_HOME);
i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(i);
}
}
我需要帮助,谢谢。