This post is the continuation of my 2 previous posts on AI2 (see below links).
Learning Android Programming Through MIT App Inventor 2
http://wei48221.blogspot.tw/2016/09/learning-android-programming-through.html#more
App Inventor 2 - How to Duplicate Project
http://wei48221.blogspot.tw/2016/09/app-inventor-2-how-to-duplicate-project.html#more
In "Learning Android Programming Through MIT App Inventor 2", I created a simple App. which plays back a song when the image (which represents a button) on the screen is touched. In this post, I want to add the start -> pause -> start (resume) feature. That's, when the image is touched for the 1st time, the App. will play back the song. When the image is touched again, the playback is paused. The playback is resumed when the image is touched again.
Below is a simple flow chart showing the entire process.
This blog is for keeping my study notes, sharing knowledge and showing the products of my study.. I welcome your feedback...
Showing posts with label Android Studio. Show all posts
Showing posts with label Android Studio. Show all posts
2016/09/15
2016/09/14
Android Studio 2.2 - How to solve the issue of "Warning: [I18N] Hardcoded string......."
When seeing warning message such as "Warning: [I18N] Hardcoded string......." it means that instead of using a string resource to hold the string, the string is hard coded into the App. Hard coding the string into the App. is not recommended because it makes it difficult for the App. to support multiple languages.
Android Studio 2.2 - How to solve the issue of "Error. The id "textView" is not defined anywhere. Did you meant textView2?"
This is a quick summary of how to solve the issue of "Error. The id "textView" is not defined anywhere. Did you meant textView2?"
Description:
When viewing the layout in Design view mode. There is a warning mark on the upper right corner of the Design view window (circled in red in the below photo).
Description:
When viewing the layout in Design view mode. There is a warning mark on the upper right corner of the Design view window (circled in red in the below photo).
2016/09/07
Android Studio 2.2 - How to copy project
Learning Android Programming Through MIT App Inventor 2
To me, the most difficult part in doing Android programming is in knowing details such as which libraries to be included, which functions to be invoked, what parameters to pass, etc..
While searching for ways to solve my problem, I came across a video called "Convert App Inventor to Java" (https://www.youtube.com/watch?v=FqNTc4DVYW8). I found that the way Derek converted his App. made with App. Inventor into Java seemed like a good solution.
This is a quick summary of how I created an App. using App Inventor 2 and re-wrote it in Java using Android Studio 2.2.
The App. that I made using App Inventor 2 is a very simple App. that plays back a song whenever I click on the picture on the screen. The detail on how to build this App. can be found at http://www.appinventor.org/content/CourseInABox/Intro/courseinabox.
The MIT App Inventor 2 is available for free at http://ai2.appinventor.mit.edu/.
App. developed using MIT App. Inventor 2
While searching for ways to solve my problem, I came across a video called "Convert App Inventor to Java" (https://www.youtube.com/watch?v=FqNTc4DVYW8). I found that the way Derek converted his App. made with App. Inventor into Java seemed like a good solution.
This is a quick summary of how I created an App. using App Inventor 2 and re-wrote it in Java using Android Studio 2.2.
The App. that I made using App Inventor 2 is a very simple App. that plays back a song whenever I click on the picture on the screen. The detail on how to build this App. can be found at http://www.appinventor.org/content/CourseInABox/Intro/courseinabox.
The MIT App Inventor 2 is available for free at http://ai2.appinventor.mit.edu/.
App. developed using MIT App. Inventor 2
2016/09/06
Android Studio 2.2 - What SDK components to download and install
This is a quick summary of what SDK components to download and install for Android Studio 2.2.
Below is a diagram that shows the distribution of various Android platforms and their API levels. When you click on a platform on the left in Android Studio, the features available since that platform are shown on the right.
Below is a diagram that shows the distribution of various Android platforms and their API levels. When you click on a platform on the left in Android Studio, the features available since that platform are shown on the right.
2015/05/16
Solution to problem uploading APK to Google Play Store
Solution to problem uploading APK to Google Play Store
Problem:
Upload failed
You need to use a different version code for your APK because you already have one with version code 1.
Solution:
In addition to updating the “android:versionCode” and ”android:versionName” in AndroidManifest.xml, the “versionCode” and “versionName” in build.gradle also need to be updated.
AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.whhuang.simplest_price_compare"
android:versionCode="3"
android:versionName="1.3">
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name=".MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "com.whhuang.simplest_price_compare"
minSdkVersion 15
targetSdkVersion 22
versionCode 3
versionName "1.3"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.1.1'
}
After the APK is successfully uploaded, a summary sheet similar to the one below will appear.
Reference: http://stackoverflow.com/questions/24772407/upload-failed-you-need-to-use-a-different-version-code-for-your-apk-because-you
2015/04/11
Solution to Problem Launching Android Device Monitor In Android Studio
Encironment:
- Android Studio 1.2 Beta
- Windows 8.1 64-bit
Problem:
When launching Android Device Monitor in Android Studio, a window pop up with the error message “An error has occurred. See the log file……”
Window with error message
The log file.
Solution:
This problem can be solved by launching Android Studio in “Administrative Mode”.
1. Close Android Studio;
2. Right click on the shortcut for Android Studio then click on “Properties”;
3. Click on “Compatibility” and check the box for “Run this program as an administrator”;
4. Click on “Apply” then “OK” to clock the window;
5. Click on the shortcut for Android Studio to launch the program. Click on “Yes” when asked whether to allow Android Studio to change the computer setting;
6. Lunch Android Device Monitor again.
Subscribe to:
Posts (Atom)








