Giter Site home page Giter Site logo

ud839_miwok's Introduction

Deprecated Repository

The associated Nanodegree program Android Basics Nanodegree by Google ND803 is deprecated now; therefore, this repository is also deprecated.

Archival Note

We are archiving this repository because we do not want learners to push personal development to the current repository. If you have any issues or suggestions to make, feel free to:

Miwok App

This app displays lists of vocabulary words for the user to learn the Miwok language. Used in a Udacity course in the Beginning Android Nanodegree.

How to use this repository

  • Fork this repository to your Github account.
  • Open Android Studio 3.2.x+ in your local machine.
  • We recommend you to use the Version Control System(VCS) in your Android Studio 3.2.x+ IDE to clone the repository directly in your IDE.
  • You may have to use the File > Settings > Version Control (VCS) menu option to set up Git settings.
  • Refer to this IntelliJ document for details.
  • Working with VCS will make it easy for you to push your updates or switch between branches to your remote repository in Github.

Prerequisites

  • Android Studio 3.2.1 or higher
  • compileSdkVersion 32 (For AndroidX dependencies, the min compileSdkVersion version is 31)
  • minSdkVersion 21
  • Supports up to Android 12
  • Gradle 7.2.0

To run app in an Android Virtual Device (AVD), we have used the following configuration:

  • Pixel 4 Mobile device with x86 System image
  • API level 30
  • Android 11

Note - Gradle Updates

The Android Studio build system depends on Gradle and its plugins. The Gradle and its plugins have to be updated separately of Android Studio. For the updated version, refer to the following updated files: ~/build.gradle (project) file ~/app/build.graddle(: app) file ~/gradle/wrapper/gradle-wrapper.properties file You can refer anytime to the latest Android Gradle plugin release notes for the newest version of plugins.

This sample uses the Gradle build system. To build this project, use the "gradlew build" command or use "Import Project" in Android Studio.

Troubleshoot

  • Gradle version and Android Gradle Plugin version should be compatible. See the table here
  • Sometimes, if you face unexpected behavior, go to File > Invalidate Caches/Restart.
  • Android Studio - How to Change Android SDK Path?
  • In case you face some unexpected errors with the Emulator, it will be beneficial to wipe out the AVD data by going to Tools >> Device Manager >> Select Device >> Wipe out option.

License

Copyright 2016 The Android Open Source Project, Inc.

Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

ud839_miwok's People

Contributors

sudkul avatar vcctu85 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ud839_miwok's Issues

SetOnClickListener issue

In the MainActivity.java file the all occurrences of new OnClickListener() should be new View.OnClickListener()

How to resolve errors in numbers.setOnClickListener and (View view)

Error in numbers.setOnClickListener and onClick(View view)
//Find the View that show the numbers category
TextView numbers = (TextView)findViewById(R.id.numbers);
//Set a clickListener on that View
numbers.setOnClickListener(new View.OnClickListener(){
@OverRide
public void onClick(View view){
//Create a new intent to open the {@link Number Activity}
Intent numbersIntent = new Intent(this, NumbersActivity.class);
//Start the new Activity
startActivity(numbersIntent);
}
});

there is a basic error

In this version of the code the sting values defined in strings.xml are different then in fragments. The code do not compile.

Nothing displays on my screen

I cannot get the code to run on my phone. I even copied and pasted to android studio and still my phone just shows a blank screen

Failed to open the project

I keep getting the error " Failed to find build tools revision 23.0.2", but even after installing the same error shows up.
ud839_miwok-starter-code - cusersmanfreddesktopud839_miwok-starter-code - android studio 2 1 3

Problems with strings (need help)

I'm not hable to pass the miwok words and setences, it get-me errors any time i try, i tried to create the resource file called "donottranslate", i tried to pass the string values for the miwok words in the strings resources file and nothing... can someone help-me please

Tabs not showing on running the app

I completed the app with the same way as the code given, but the tabs re not being shown. no error is there. but when i downloaded the code and ran that, tabs are show. pls tell where i m wrong

gradle sync failed

I am getting this error..please help me..i had given the right path of SDK still the error occurs.
`
SDK location not found. Define location with sdk.dir in the local.properties file or with an ANDROID_HOME environment variable.

`apply plugin: 'com.android.application'

android {
compileSdkVersion 23
buildToolsVersion "23.0.1"

defaultConfig {
    applicationId "com.example.android.miwok"
    minSdkVersion 15
    targetSdkVersion 23
    versionCode 1
    versionName "1.0"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}

}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.3.0'
compile 'com.android.support:support-v4:23.3.0'
compile 'com.android.support:design:23.3.0'
}
`

getting bytecode to dec and null point exception errors

Error:Error converting bytecode to dex:
Cause: java.lang.RuntimeException: Exception parsing classes
Error:Execution failed for task ':app:transformClassesWithDexForDebug'.

com.android.build.api.transform.TransformException: java.lang.RuntimeException: java.lang.RuntimeException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: java.lang.UnsupportedOperationException
Error:1 error; aborting

PhrasesActivity is broken

After i put the audio file IDs, The Layout is no longer showing the text views. but the audio plays. Seems to me like the new objects are confused by the resource IDs (as in, they cannot figure out whether the third inputs are images or audio files since they are both int type and image input comes before audio input.

Tutorial Codes Pre-written!

On importing this file, i found out that most of the upcoming tutorial's code is already inside mainActivity.java/also the 4 activities were already included.

error

Cannot run program "git.exe": CreateProcess error=2, The system cannot find the file specified

Setting.jar not found

hey guys i am facing the same problem it say cannot find settings. jar and i cant understand what is the mean by removing the build file and perform clean project

A different approach

I just tried to use the WordAdapter alone to also pick up audio resources for the currentWord as well as managing AudioFocus. This way I never really needed to modify all the category activities (NumbersActivity, FamilyActivity, etc…).

This is what it looks like:

`package com.example.android.miwok;

import android.app.Activity;
import android.content.Context;
import android.media.AudioManager;
import android.media.MediaPlayer;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.content.ContextCompat;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.widget.TextView;

import java.util.ArrayList;

/**

  • Created by @pramdsravan on 8/11/2017.
    */

public class WordAdapter extends ArrayAdapter {
private static final String LOG_TAG = WordAdapter.class.getSimpleName();
private static MediaPlayer mediaPlayer;
private int mColorResourceId;
private AudioManager mAudioManager;
//Register an onAudioFocusChangeListener
AudioManager.OnAudioFocusChangeListener mOnAudioFocusChangeListener = new AudioManager.OnAudioFocusChangeListener() {
@OverRide
public void onAudioFocusChange(int focusChange) {
// || = "or"
if (focusChange == AudioManager.AUDIOFOCUS_LOSS_TRANSIENT ||
focusChange == AudioManager.AUDIOFOCUS_LOSS_TRANSIENT_CAN_DUCK) {
/* The AUDIOFOCUS_LOSS_TRANSIENT case means we've lost audio focus for a
* short amount of time. The AUDIOFOCUS_LOSS_TRANSIENT_CAN_DUCK case means
* our app is allowed to continue playing sound but at a lower volume. We want
* both cases the same way because our app is playing short sound files.*/
// Pause playback and reset player.
mediaPlayer.pause();
// To restart the audiofile from the beginning, instead of resume playback
mediaPlayer.seekTo(0);

            // Pause playback
        } else if (focusChange == AudioManager.AUDIOFOCUS_GAIN) {
            // The AUDIOFOCUS_GAIN case means we have regained focus and can resume playback
            mediaPlayer.start();
        } else if (focusChange == AudioManager.AUDIOFOCUS_LOSS) {
            // AUDIOFOCUS_LOSS means we've lost audiofocus & should stop playback and
            // clean up resources
            releaseMediaPlayer();
        }
    }
};

/**
 * This is our own custom constructor (it doesn't mirror a supercalss constructor).
 * The context is used to inflate the layout file, and the list is the data we want to populate into the lists.
 *
 * @param context The current context. Used to inflate the layout file.
 * @param words   A list of default & Miwok words to diplay in a list.
 */

public WordAdapter(Activity context, ArrayList<Word> words, int colorResourceId) {
    //Here, we initialize the ArrayAdapter's internal storage for the context and the list.
    //The second argument is used when the ArrayAdapter is populating a single TextView.
    //Because this is a custom adapter for two TextViews and an Image VIew, the adapter is not
    //going to use this second argument, so it can be any value. Here, we used 0.
    super(context, 0, words);
    mColorResourceId = colorResourceId;
}

/**
 * Provides a view for an AdapterView (ListView, GridView, etc.)
 *
 * @param position    The position in the list of data that should be displayed in the list item view.
 * @param convertView The recycled view to populate.
 * @param parent      The parent ViewGroup that is used for inflation.
 * @return The View for the position in the AdapterView.
 */
@NonNull
@Override
public View getView(int position, @Nullable View convertView, @NonNull ViewGroup parent) {
    //Check if the existing view is being reused, otherwise inflate the view
    View listItemView = convertView;
    if (listItemView == null) {
        listItemView = LayoutInflater.from(getContext()).inflate(R.layout.list_item, parent, false);
    }
    //Get the {@link Word} object loacted at this position in the list
    final Word currentWord = getItem(position);

    //Find the TextView in the list_item.xml layout with the Id item_2
    TextView defaultTextView = (TextView) listItemView.findViewById(R.id.item_2);
    //Get the default translation of the current default Word object and set this text on the miwok TextView
    defaultTextView.setText(currentWord.getDefaultTranslation());

    //Find the TextView in the list_item.xml layout with the Id item_1
    TextView miwokTextView = (TextView) listItemView.findViewById(R.id.item_1);
    //Get the miwok translation of the current Word object and set this on miwok TextView
    miwokTextView.setText(currentWord.getMiwokTranslation());

    //Find the ImageView in the list_item.xml layout with the Id image_1
    ImageView imageView = (ImageView) listItemView.findViewById(R.id.image_1);
    // Check if an Image is provided for the currentWord
    if (currentWord.hasImage()) {
        //Get the imageResource of the currnet Word object and set this on imageView
        imageView.setImageResource(currentWord.getImageResourceId());
        //Make sure the view is visible
        imageView.setVisibility(View.VISIBLE);
    } else {
        //Otherwise hide the imageView
        imageView.setVisibility(View.GONE);
    }

    //set the background color for the text container
    View textContainer = listItemView.findViewById(R.id.text_container);
    int color = ContextCompat.getColor(getContext(), mColorResourceId);
    textContainer.setBackgroundColor(color);

    //set onClickListener on the textContainer to trigger audio playback
    textContainer.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {

            if (requestAF() == AudioManager.AUDIOFOCUS_REQUEST_GRANTED) {
                //release mediaPlayer if it is already invoked
                releaseMediaPlayer();
                //set up the mediaPlayer to playback miwok words
                mediaPlayer = MediaPlayer.create(getContext(), currentWord.getAudioResourceId());
                //play audio file
                mediaPlayer.start();
                //release mediaPlayer resource once the audio completes
                mediaPlayer.setOnCompletionListener(new MediaPlayer.OnCompletionListener() {
                    @Override
                    public void onCompletion(MediaPlayer mediaPlayer) {
                        releaseMediaPlayer();
                        mAudioManager.abandonAudioFocus(mOnAudioFocusChangeListener);
                    }
                });
            }
        }
    });
    return listItemView;
}

//Helper method to release MediaPlayer resources
public static void releaseMediaPlayer() {
    //if mediaPlayer is not null, it may be currently playing a sound
    if (mediaPlayer != null) {
        //Irrespective of mediaPlayer state, release its reources becasue we no longer need it
        mediaPlayer.release();
        //setting mediaPlayer to null to indicate it is idle.
        mediaPlayer = null;
    }
}

//Manage AudioFocus
public int requestAF() {
    mAudioManager = (AudioManager) getContext().getSystemService(Context.AUDIO_SERVICE);
    int result = mAudioManager.requestAudioFocus(mOnAudioFocusChangeListener, AudioManager.STREAM_MUSIC, AudioManager.AUDIOFOCUS_GAIN_TRANSIENT);
    return result;
}

}`

And here's what my NumbersActivty looks like.
All my other activities look pretty much the same.

`package com.example.android.miwok;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.widget.ListView;

import java.util.ArrayList;

public class NumbersActivity extends AppCompatActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.word_list);

    //Create list of words
    ArrayList<Word> words = new ArrayList<Word>();

    /*Collections.addAll(words, "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "ten");
    LinearLayout rootView = (LinearLayout) findViewById(R.id.rootView);
    int index = 0;
    while (index < words.size()) {
        TextView wordView = new TextView(this);
        wordView.setText(words.get(index));
        rootView.addView(wordView);
        index++;
    }*/

    words.add(new Word("one", "lutti", R.drawable.number_one, R.raw.number_one));
    words.add(new Word("two", "otiiko", R.drawable.number_two, R.raw.number_two));
    words.add(new Word("three", "tolookosu", R.drawable.number_three, R.raw.number_three));
    words.add(new Word("four", "oyyisa", R.drawable.number_four, R.raw.number_four));
    words.add(new Word("five", "massokka", R.drawable.number_five, R.raw.number_five));
    words.add(new Word("six", "temmokka", R.drawable.number_six, R.raw.number_six));
    words.add(new Word("seven", "kenekaku", R.drawable.number_seven, R.raw.number_seven));
    words.add(new Word("eight", "kawinta", R.drawable.number_eight, R.raw.number_eight));
    words.add(new Word("nine", "wo’e",R.drawable.number_nine, R.raw.number_nine));
    words.add(new Word("ten", "na’aacha",R.drawable.number_ten, R.raw.number_ten));

    /*ArrayAdapter<String> itemsAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, words);
    ListView listView = (ListView) findViewById(R.id.list);
    listView.setAdapter(itemsAdapter);*/
    //GridView gridView = (GridView) findViewById(R.id.list);
    //gridView.setAdapter(itemsAdapter);

    //Cretae an {@link WordAdapter}, whoise data source is a list of {!link Word}s.
    //The adapter knows how to create list items for each item in the list.

    WordAdapter adapter = new WordAdapter(this, words, R.color.category_numbers);

    // Find the {@link ListView} object in the view hierarchy of the {@link Activity}.
    // There should be a {@link ListView} with the view ID called list, which is declared in the
    // word_listyout file.

    ListView listView = (ListView) findViewById(R.id.list);

    // Make the {@link ListView} use the {@link WordAdapter} we created above, so that the
    // {@link ListView} will display list items for each {@link Word} in the list.

    listView.setAdapter(adapter);
}

@Override
protected void onStop(){
    super.onStop();
    WordAdapter.releaseMediaPlayer();
}

}`

Setting.jar file not found

Hi Team
when downloaded project zip file, and trying to import, then getting message "can not find file" " setting.jar" file is not found.

any input ?

Cannot resolve symbol word_list

It says cannot resolve symbol word_list in the NumbersActivity.java file.
Down below is my code for the NumbersActivity.java file:
/*

  • Copyright (C) 2016 The Android Open Source Project
  • Licensed under the Apache License, Version 2.0 (the "License");
  • you may not use this file except in compliance with the License.
  • You may obtain a copy of the License at
  •  http://www.apache.org/licenses/LICENSE-2.0
    
  • Unless required by applicable law or agreed to in writing, software
  • distributed under the License is distributed on an "AS IS" BASIS,
  • WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  • See the License for the specific language governing permissions and
  • limitations under the License.
    */
    package com.example.android.miwok;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.widget.ListView;

import java.util.ArrayList;

public class NumbersActivity extends AppCompatActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.word_list);

    // Create a list of words
    ArrayList<Word> words = new ArrayList<Word>();
    words.add(new Word("one", "lutti"));
    words.add(new Word("two", "otiiko"));
    words.add(new Word("three", "tolookosu"));
    words.add(new Word("four", "oyyisa"));
    words.add(new Word("five", "massokka"));
    words.add(new Word("six", "temmokka"));
    words.add(new Word("seven", "kenekaku"));
    words.add(new Word("eight", "kawinta"));
    words.add(new Word("nine", "wo’e"));
    words.add(new Word("ten", "na’aacha"));

    // Create an {@link WordAdapter}, whose data source is a list of {@link Word}s. The
    // adapter knows how to create list items for each item in the list.
    WordAdapter adapter = new WordAdapter(this, words);

    // Find the {@link ListView} object in the view hierarchy of the {@link Activity}.
    // There should be a {@link ListView} with the view ID called list, which is declared in the
    // word_list.xml layout file.
    ListView listView = (ListView) findViewById(R.id.list);

    // Make the {@link ListView} use the {@link WordAdapter} we created above, so that the
    // {@link ListView} will display list items for each {@link Word} in the list.
    listView.setAdapter(adapter);
}

}

Preview not working

screen shot 2018-01-03 at 6 40 49 pm

Copied the idk what this really is:- java.lang.ClassNotFoundException: android.support.v4.view.TintableBackgroundView at org.jetbrains.android.uipreview.ModuleClassLoader.load(ModuleClassLoader.java:181) at com.android.tools.idea.rendering.RenderClassLoader.findClass(RenderClassLoader.java:56) at org.jetbrains.android.uipreview.ModuleClassLoader.findClass(ModuleClassLoader.java:119) at java.lang.ClassLoader.loadClass(ClassLoader.java:424) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) at org.jetbrains.android.uipreview.ModuleClassLoader.loadClass(ModuleClassLoader.java:214) at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:763) at java.lang.ClassLoader.defineClass(ClassLoader.java:642) at com.android.tools.idea.rendering.RenderClassLoader.defineClassAndPackage(RenderClassLoader.java:177) at com.android.tools.idea.rendering.RenderClassLoader.loadClassFromJar(RenderClassLoader.java:92) at org.jetbrains.android.uipreview.ModuleClassLoader.load(ModuleClassLoader.java:171) at com.android.tools.idea.rendering.RenderClassLoader.findClass(RenderClassLoader.java:56) at org.jetbrains.android.uipreview.ModuleClassLoader.findClass(ModuleClassLoader.java:119) at java.lang.ClassLoader.loadClass(ClassLoader.java:424) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) at org.jetbrains.android.uipreview.ModuleClassLoader.loadClass(ModuleClassLoader.java:214) at org.jetbrains.android.uipreview.ViewLoader.loadClass(ViewLoader.java:500) at org.jetbrains.android.uipreview.ViewLoader.loadClass(ViewLoader.java:254) at org.jetbrains.android.uipreview.ViewLoader.loadClass(ViewLoader.java:215) at com.android.tools.idea.rendering.LayoutlibCallbackImpl.loadClass(LayoutlibCallbackImpl.java:218) at android.view.BridgeInflater.loadCustomView(BridgeInflater.java:336) at android.view.BridgeInflater.onCreateView(BridgeInflater.java:155) at android.view.LayoutInflater.onCreateView(LayoutInflater.java:720) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:788) at android.view.BridgeInflater.createViewFromTag(BridgeInflater.java:225) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:730) at android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:863) at android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:72) at android.view.LayoutInflater.rInflate(LayoutInflater.java:837) at android.view.LayoutInflater.inflate(LayoutInflater.java:489) at com.android.layoutlib.bridge.bars.CustomBar.(CustomBar.java:90) at com.android.layoutlib.bridge.bars.NavigationBar.(NavigationBar.java:52) at com.android.layoutlib.bridge.bars.NavigationBar.(NavigationBar.java:46) at com.android.layoutlib.bridge.impl.Layout.createNavBar(Layout.java:325) at com.android.layoutlib.bridge.impl.Layout.(Layout.java:151) at com.android.layoutlib.bridge.impl.RenderSessionImpl.inflate(RenderSessionImpl.java:288) at com.android.layoutlib.bridge.Bridge.createSession(Bridge.java:384) at com.android.tools.idea.layoutlib.LayoutLibrary.createSession(LayoutLibrary.java:193) at com.android.tools.idea.rendering.RenderTask.createRenderSession(RenderTask.java:547) at com.android.tools.idea.rendering.RenderTask.lambda$inflate$3(RenderTask.java:681) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745)

Can not open the project

I tried many ways to open the project, but none of them works with me. I stuck in "Building 'Miwok' Gradle project info! I been looking for many solution online for this is problem but none of them solve my problem. Pleas help me!

Unfortunately, Miwok has stopped.

After putting the "releaseMediaPlayer()" method on the category (such as in NumbersActivity), after clicking any of the word, instead of playing the audio - the app is unfortunately closing. Without this method. the app is running fine. What's the problem can be?

Cannot Resolve Symbol 'miwok_number_***' ? I don't understand what I have done wrong

final ArrayList words = new ArrayList();
words.add(new Word(R.string.number_one, R.string.miwok_number_one,
R.drawable.number_one, R.raw.number_one));
words.add(new Word(R.string.number_two, R.string.miwok_number_two,
R.drawable.number_two, R.raw.number_two));
words.add(new Word(R.string.number_three, R.string.miwok_number_three,
R.drawable.number_three, R.raw.number_three));
words.add(new Word(R.string.number_four, R.string.miwok_number_four,
R.drawable.number_four, R.raw.number_four));
words.add(new Word(R.string.number_five, R.string.miwok_number_five,
R.drawable.number_five, R.raw.number_five));
words.add(new Word(R.string.number_six, R.string.miwok_number_six,
R.drawable.number_six, R.raw.number_six));
words.add(new Word(R.string.number_seven, R.string.miwok_number_seven,
R.drawable.number_seven, R.raw.number_seven));
words.add(new Word(R.string.number_eight, R.string.miwok_number_eight,
R.drawable.number_eight, R.raw.number_eight));
words.add(new Word(R.string.number_nine, R.string.miwok_number_nine,
R.drawable.number_nine, R.raw.number_nine));
words.add(new Word(R.string.number_ten, R.string.miwok_number_ten,
R.drawable.number_ten, R.raw.number_ten));

Error:Execution failed for task ':app:processDebugManifest'.

Error:Execution failed for task ':app:processDebugManifest'.

Manifest merger failed : uses-sdk:minSdkVersion 1 cannot be smaller than version 14 declared in library [com.android.support:design:26.1.0] C:\Users\YasserMagdad.gradle\caches\transforms-1\files-1.1\design-26.1.0.aar\4e8ddd06535b838073632601926eff5b\AndroidManifest.xml as the library might be using APIs not available in 1
Suggestion: use a compatible library with a minSdk of at most 1,
or increase this project's minSdk version to at least 14,
or use tools:overrideLibrary="android.support.design" to force usage (may lead to runtime failures)

Can't resolve AppCompatActivity

I've imported this code into my android studio but having problem in it...
it says AppCompatActivity can't be resolved
moreover style parent setting is even a issue...
please help asap...
Thanks

Can't run app on Virtual Device

Can't run app on virtual device, preview works fine. Maybe some problems with APK versions? What i'm noticing thats an errorr in Manifest file
default
But i dont see some errorrs on building app

Got this error when Colors is pressed after using Fragment Class

11-02 19:12:55.755 1545-1591/com.example.android.miwok D/AppTracker: App Event: stop
11-02 19:12:55.779 1545-1545/com.example.android.miwok V/BoostFramework: BoostFramework() : mPerf = com.qualcomm.qti.Performance@3ca35be
11-02 19:12:55.779 1545-1545/com.example.android.miwok V/BoostFramework: BoostFramework() : mPerf = com.qualcomm.qti.Performance@86cf61f
11-02 19:12:55.803 1545-1545/com.example.android.miwok D/AndroidRuntime: Shutting down VM
11-02 19:12:55.803 1545-1545/com.example.android.miwok E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.android.miwok, PID: 1545
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.android.miwok/com.example.android.miwok.ColorsActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.widget.ListView.setAdapter(android.widget.ListAdapter)' on a null object reference
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2733)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2819)
at android.app.ActivityThread.-wrap12(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1532)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6321)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.widget.ListView.setAdapter(android.widget.ListAdapter)' on a null object reference
at com.example.android.miwok.ColorsFragment.onCreateView(ColorsFragment.java:179)
at android.support.v4.app.Fragment.performCreateView(Fragment.java:1974)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1067)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1252)
at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:742)
at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1617)
at android.support.v4.app.FragmentController.execPendingActions(FragmentController.java:339)
at android.support.v4.app.FragmentActivity.onStart(FragmentActivity.java:602)
at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1322)
at android.app.Activity.performStart(Activity.java:6777)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2696)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2819) 
at android.app.ActivityThread.-wrap12(ActivityThread.java) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1532) 
at android.os.Handler.dispatchMessage(Handler.java:102) 
at android.os.Looper.loop(Looper.java:154) 
at android.app.ActivityThread.main(ActivityThread.java:6321) 
at java.lang.reflect.Method.invoke(Native Method) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776) 
11-02 19:12:55.803 1545-1545/com.example.android.miwok D/AppTracker: App Event: crash

Gradle Build Taking too long after adding Images

Gradle Build is taking too long after I added the images and updated the Java files and the WordAdapter.
It's currently 21 minutes as I am writing this since I clicked on the run App button. I've lost all hope that the Gradle Build will finish this year.

Before these changes, Gradle Build usually finished in about 2-3 minutes.

What to do?

Gradle Sync Error .

Error:Failed to open zip file.

Gradle's dependency cache may be corrupt (this sometimes occurs after a network connection timeout.)
Re-download dependencies and sync project (requires network)
Re-download dependencies and sync project (requires network)

position varable

I have problem with this line position variable

Word word = words.get(position);

error: cannot find symbol variable position

I use the MediaPlayer class in WordAdapter

` //Set the audio from the resource ID

    final MediaPlayer mediaPlayer = MediaPlayer.create(getContext(), currentWord.getAudioResourceId());

    textContainer.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            mediaPlayer.start();// no need to call prepare(); create() does that for you

        }
    });

    // Return the whole list item layout (containing 2 TextViews) so that it can be shown in
    // the ListView.
    return listItemView;
}

}`

Project Not Importing Properly

Hello,

When I execute the following steps in Android Studio,

**Steps:

  1. Open Android Studio

  2. Click Import project

  3. Set Path to Extracted Project Directory

  4. Choose "Import project from external model" and select "Gradle"

  5. Hit "Next"

  6. Set Gradle project: (Path to Extracted Project Directory)

  7. Click radio button with text "Use local gradle distribution"

  8. Set Gradle home: C:/Program Files/Android/Android Studio/gradle/gradle-3.2

  9. Set Project format: .idea (directory based)

  10. Hit "Finish"**


I receive the message:

"Frameworks detected: Android framework is detected in the project Configure"


I've looked around quite a bit to find solutions to this import, but there has been no success.
I've attached two screenshots of the current SDK manager specs/versions.

Any assistance would be appreciated. Thank you.

App closes upon updating the NumbersActivity

What am I doing wrong? I have updated the complete NumbersActivity, following the show me the answer clip, but it doesn't resemble the final code, nor does it work. I had a crash upon opening the NumbersActivity which I solved with an If statement mMediaPlayer != null and now I can open the activity, but no sound plays and hitting it a couple of times, it shuts down.

Below my code:

package com.example.android.miwok;

import android.content.Context;
import android.media.AudioManager;
import android.media.MediaPlayer;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ListView;
import java.util.ArrayList;

public class NumbersActivity extends AppCompatActivity {

// Handles playback of all the sound files
private MediaPlayer mMediaPlayer;
//Handles audio focus when playing a sound file
private AudioManager mAudioManager;


private AudioManager.OnAudioFocusChangeListener mOnAudioFocusChangeListener =
        new AudioManager.OnAudioFocusChangeListener() {
            @Override
            public void onAudioFocusChange(int focusChange) {
                // || = "or"
                if (focusChange == AudioManager.AUDIOFOCUS_LOSS_TRANSIENT ||
                        focusChange == AudioManager.AUDIOFOCUS_LOSS_TRANSIENT_CAN_DUCK) {
                    /* The AUDIOFOCUS_LOSS_TRANSIENT case means we've lost audio focus for a
                    * short amount of time. The AUDIOFOCUS_LOSS_TRANSIENT_CAN_DUCK case means
                    * our app is allowed to continue playing sound but at a lower volume. We want
                    * both cases the same way because our app is playing short sound files.*/
                    // Pause playback and reset player.
                    mMediaPlayer.pause();
                    // To restart the audiofile from the beginning, instead of resume playback
                    mMediaPlayer.seekTo(0);

                      // Pause playback
                } else if (focusChange == AudioManager.AUDIOFOCUS_GAIN) {
                    // The AUDIOFOCUS_GAIN case means we have regained focus and can resume playback
                    mMediaPlayer.start();
                } else if (focusChange == AudioManager.AUDIOFOCUS_LOSS) {
                    // AUDIOFOCUS_LOSS means we've lost audiofocus & should stop playback and
                    // clean up resources
                    releaseMediaPlayer();
                }
            }
        };

//This listener gets triggered when the {@link MediaPlayer} has completed playing the audio file
private MediaPlayer.OnCompletionListener mCompletionListener = new MediaPlayer.OnCompletionListener() {

   public void onCompletion(MediaPlayer mp) {
        releaseMediaPlayer();
   }
};

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.word_list);

    // Create and setup the {@link AudioManager} to request audio focus
    mAudioManager = (AudioManager) getSystemService(Context.AUDIO_SERVICE);

    // Create a list of words
    final ArrayList<Word> words = new ArrayList<Word>();
    words.add(new Word("one", "lutti",R.drawable.number_one, R.raw.number_one));
    words.add(new Word("two", "otiiko",R.drawable.number_two, R.raw.number_two));
    words.add(new Word("three", "tolookosu",R.drawable.number_three, R.raw.number_three));
    words.add(new Word("four", "oyyisa",R.drawable.number_four, R.raw.number_four));
    words.add(new Word("five", "massokka",R.drawable.number_five, R.raw.number_five));
    words.add(new Word("six", "temmokka",R.drawable.number_six, R.raw.number_six));
    words.add(new Word("seven", "kenekaku",R.drawable.number_seven, R.raw.number_seven));
    words.add(new Word("eight", "kawinta",R.drawable.number_eight, R.raw.number_eight));
    words.add(new Word("nine", "wo'e",R.drawable.number_nine, R.raw.number_nine));
    words.add(new Word("ten", "na'aacha",R.drawable.number_ten, R.raw.number_ten));


    // Create an {@link WordAdapter}, whose data source is a list of {@link Word}s. The
    // adapter knows how to create list items for each item in the list
    // The simple_list_item_1.xml layout resource defined in the Android framework is not used.
    WordAdapter adapter = new WordAdapter(this, words, R.color.category_numbers);

    // Find the {@link ListView} object in the view hierarchy of the {@link Activity}.
    // There should be a {@link ListView} with the view ID called list, which is declared in the
    // word_list.xml file.
    ListView listView = (ListView) findViewById(R.id.list);

    // Make the {@link ListView} use the {@link WordAdapter} we created above, so that the
    // {@link ListView} will display list items for each {@link Word} in the list.
    listView.setAdapter(adapter);

    // Set a click listener to play the audio when the list item is clicked on
    listView.setOnItemClickListener(new AdapterView.OnItemClickListener(){
        @Override
        public void onItemClick(AdapterView<?> adapterView, View view, int position, long l) {
            //Get the {@link Word} object at the given position the user clicked on
            Word word = words.get(position);
            // Release the media player if it currently exists, to play a different sound file
            releaseMediaPlayer();

            // Request audio focus for playback
            int result = mAudioManager.requestAudioFocus(mOnAudioFocusChangeListener,
                    // Use the music stream.   // Request permanent focus.
                    AudioManager.STREAM_MUSIC, AudioManager.AUDIOFOCUS_GAIN_TRANSIENT);
            // Start the audio file
            mMediaPlayer.start();

            if (result == AudioManager.AUDIOFOCUS_REQUEST_GRANTED) {
                if (mMediaPlayer != null) {
                    // Stetup a listener on the media player to stop and release player when finished playing
                    mMediaPlayer.setOnCompletionListener(mCompletionListener);
                        // We have audio focus now
                        // Create + setup the {@link Mediaplayer} for the audio resource for the current word
                        mMediaPlayer = MediaPlayer.create(NumbersActivity.this, word.getAudioResourceId());
                        // Start the audio file
                        mMediaPlayer.start(); //No need to call prepare(), create does that for you
                        // Setup a listener on the media player to stop and release it once sound has finished playing
                        mMediaPlayer.setOnCompletionListener(mCompletionListener);}
                }
        }
    });
}
@Override
protected void onStop() {
    super.onStop();
    // When the activity stops, release media player resources to stop playing sounds
    releaseMediaPlayer();
}
//Clean up the media player by releasing its resources.
private void releaseMediaPlayer() {
    // If the media player is not null, then it may be currently playing a sound.
    if (mMediaPlayer != null) {
        // Regardless of the current state of the media player, release its resources
        // because we no longer need it.
        mMediaPlayer.release();

        // Set the media player back to null. For our code, we've decided that
        // setting the media player to null is an easy way to tell that the media player
        // is not configured to play an audio file at the moment.
        mMediaPlayer = null;

        // Regardless of whether or not we were granted audio focus, abandon is. This also
        // unregisters the AudioFocusChangeListener so we don't get anymore callbacks
        mAudioManager.abandonAudioFocus(mOnAudioFocusChangeListener);

    }
}

}

No XML and gradle not running

I have spent 2 hours trying to fix this and I'm at a complete loss as to what to do...
I have updated Android Studio and it still doesn't work.

I unzip the zipped folder. I import a project. I select the imported project.

The next bit frustrates me because there are a tonne of options and stages to go through and no where is there any indication of how to navigate this. Most of the terminology is completely new to me but it is assumed I should understand it.

Anyway,I import from a file (rather than externally). I then leave it at 1.8SDK although I also attempted the other options.

When the project loads up it says it isn't running gradle and all internet instructions on how to address this, including the Android page do not seem to be having this issue.
There is also no xml visible, only java
The java also has many errors
There is also no way of running the app

Please help me get past these issues?!!!
Thank you
Ed

Gradle, sync, opening zip errors

I tried all of the possible solutions but none worked. Everytime a new error pops up
This is the error it shows in the log now. Please help how to fix this.. have been stuck with this for almost 3 weeks now. Eagerly waiting for the MIWOK project to show up properly.

Error:Failed to open zip file.
Gradle's dependency cache may be corrupt (this sometimes occurs after a network connection timeout.)
Re-download dependencies and sync project (requires network)
Re-download dependencies and sync project (requires network)

Having issue importing file

So i followed direction of the video, and I imported the file into Android Stuido, but I am unable to run the app and I get a gradle not synced issue... I tried multiple time to resolve the issue and I also deleted files and re-imported the file and still get same issues. Assistance would be greatly appreciated.

can't import project

For some reason everytime I download the zip file and try to open it up in android studio I get
"Cannot import anything from C:/Users/Anghel/Downloads/ud839_Miwok-Starter-code.zip"

Play one audio song

When I clicked any item of listview to star the song, it couldn't play it. The songs are in the raw directory of res. How can I solve the problem?

Also, the icon of song file shows "?" , What does it mean?

Maybe, it can cause the volume to 0

Here is the code below.

listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
           @Override
           public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
               //Toast.makeText(NumbersActivity.this,"List Item Clicked",Toast.LENGTH_SHORT).show();
               mediaPlayer = MediaPlayer.create(NumbersActivity.this, R.raw.number_one);
               mediaPlayer.start(); // no need to call prepare(); create() does that for you

           }
       });

Gradle project sync failed

When try to import project to studio get error - Gradle project sync failed-Debugging will not work properly

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.