hussien89aa / androidtutorialforbeginners Goto Github PK
View Code? Open in Web Editor NEWStep by step to build Android apps using Android Studio
Home Page: https://www.udemy.com/android-tutorial-for-beginners/?couponCode=ANDORIDGITHUB
Step by step to build Android apps using Android Studio
Home Page: https://www.udemy.com/android-tutorial-for-beginners/?couponCode=ANDORIDGITHUB
Please always use mysqli_real_escape_string when you use data from $_GET.
Problem in files:
"Invalid byte 1 of 1-byte UTF-8 sequence."
I am getting this error during gradle sync in android studio 3.4.2 on ubuntu 16.04, please can you help me I am unable to solve this issue, even stackoverflow solutions are not working...
please ignore. Sorry!
Executing tasks: [:app:JavaBasics.main()] in project C:\Users\PC\AndroidStudioProjects\HelloAndroid\ app
Configure project :app
The JavaExec.main property has been deprecated. This is scheduled to be removed in Gradle 8.0.
Please use the mainClass property instead. See https://docs.gradle.org/7.3.3/dsl/org.gradle.api tasks.JavaExec.html#org.gradle.api.tasks. JavaExec:main for more details.
at JavaBasics_main___bifh9cjzt8vxkptppv3mbuljd$_run_closure1$_closure2$_closure3.docall
(C\Users\PC\AppData\Local\Temp\JavaBasics_main__.gradle:23)
(Run with -- stacktrace to get the full stack trace of this deprecation warning.)
FAILURE: Build failed with an exception.
Initialization script 'C:\Users\PC\AppData\Local\Temp\JavaBasics_main___.gradle' line: 41
A problem occurred configuring project ':app'.
Could not create task ':app:JavaBasics.main()".
> SourceSet with name 'main' not found.
Run with -- stacktrace option to get the stack trace.
Run with -- info or -- debug option to get more log output.
Run with -- scan to get full insights.
BUILD FAILED in 3s
ello
I installed Android Studio 3.1.3
I installed all Sdk
But he does not know a whole series of public classes like findviewbyid
The next problem is that I've added a series of library to the project but gets the error
I'm taking two pictures. I'm having trouble !!!!
Truly this is my SDK project information
compileSdkVersion 28
buildToolsVersion '27.0.3'
useLibrary 'org.apache.http.legacy'
defaultConfig {
minSdkVersion 22
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
Thank you for guiding me what to do
hi
I'm having the android application. i will be putting the application to background. now i need to check, if the app is active or ideal state. for example : some application may do some operation even though its in background, like playing Audio or Video or downloading.
i want to know how to check it in android studio? thanks
Kotlin, Java...
import com.apptracker.android.listener.AppModuleListener;
import com.apptracker.android.track.AppTracker;
// Leadbolt SDK imports
public class MainActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
if(savedInstanceState == null) {
// Initialize Leadbolt SDK with your api key
AppTracker.startSession(getApplicationContext(),"YOUR_APP_API_KEY",AppTracker.ENABLE_AUTO_CACHE);
}
// cache Leadbolt Ad without showing it
AppTracker.loadModuleToCache(getApplicationContext(),"inapp");
}
public void gameOver() {
// call this when you want to display the Leadbolt Interstitial
if(AppTracker.isAdReady("inapp")) {
AppTracker.loadModule(getApplicationContext(),"inapp");
}
}
}
AppTracker.setAgeRange("18-25");
// Allowed values for Age range are: "13-17", "18-25", "26-35", "36-45", "46+"
AppTracker.setGender("Female");
// Allowed values for Gender are: "Male", "Female"
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
import com.apptracker.android.listener.AppModuleListener;
import com.apptracker.android.track.AppTracker;
// Leadbolt SDK imports
public class MainActivity extends Activity {
private AppModuleListener leadboltListener = new AppModuleListener() {
@Override
public void onModuleLoaded(String location) {
// Add code here to pause game and/or all media including audio
}
@Override
public void onModuleFailed(String location, String error, boolean isCache) {}
@Override
public void onModuleClosed(String location) {
// Add code here to resume game and/or all media including audio
}
@Override
public void onModuleClicked(String location) {}
@Override
public void onModuleCached(String location) {
// Add code if not auto-recaching for when loadModuleModuleToCache is successful
}
@Override
public void onMediaFinished(boolean viewCompleted) {
if(viewCompleted) {
Log.i("AppTracker", "User finished watching rewarded video");
} else {
Log.i("AppTracker", "User skipped watching rewarded video");
}
}
};
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
if(savedInstanceState == null) {
// Initialize Leadbolt SDK with your api key
AppTracker.setModuleListener(leadboltListener);
AppTracker.startSession(getApplicationContext(),"YOUR_APP_API_KEY",AppTracker.ENABLE_AUTO_CACHE);
}
// cache Leadbolt Video Ad without showing it
AppTracker.loadModuleToCache(getApplicationContext(),"video");
}
public void gameOver() {
// call this when you want to display the Leadbolt Video
if(AppTracker.isAdReady("video")) {
AppTracker.loadModule(getApplicationContext(),"video");
}
}
}
1
2
3
4
5
AppTracker.setAgeRange("18-25");
// Allowed values for Age range are: "13-17", "18-25", "26-35", "36-45", "46+"
AppTracker.setGender("Female");
// Allowed values for Gender are: "Male", "Female"
private AppModuleListener leadboltListener = new AppModuleListener() {
@OverRide
public void onModuleLoaded(String location) {
Log.i("AppTracker", "Ad loaded successfully - "+location);
// Add code here to pause game and/or all media including audio
}
@OverRide
public void onModuleFailed(String location, String error, boolean isCache) {
if(isCache) {
Log.i("AppTracker", "Ad failed to cache - "+location);
} else {
Log.i("AppTracker", "Ad failed to display - "+location);
}
}
@OverRide
public void onModuleClosed(String location) {
Log.i("AppTracker", "Ad closed by user - "+location);
// Add code here to resume game and/or all media including audio
}
@OverRide
public void onModuleClicked(String location) {
Log.i("AppTracker", "Ad clicked by user - "+location);
}
@OverRide
public void onModuleCached(String location) {
Log.i("AppTracker", "Ad cached successfully - "+location);
// Add code if not auto-recaching for when loadModuleModuleToCache is successful
}
@OverRide
public void onMediaFinished(boolean viewCompleted) {
if(viewCompleted) {
Log.i("AppTracker", "User finished watching rewarded video");
} else {
Log.i("AppTracker", "User skipped watching rewarded video");
}
}
};
2
AppTracker.setModuleListener(leadboltListener);
AppTracker.startSession(getApplicationContext(),"YOUR_APP_API_KEY",AppTracker.ENABLE_AUTO_CACHE);
When I try to open the application, the application should open and all its options should be displayed.
The application crashes when I try to open the application
E/AndroidRuntime(19861): FATAL EXCEPTION: main
E/AndroidRuntime(19861): Process: com.udemy.android, PID: 19861
E/AndroidRuntime(19861): java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/com.udemy.android-1/base.apk"],nativeLibraryDirectories=[/vendor/lib, /system/lib]]] couldn't find "libsqlcipher.so"
E/AndroidRuntime(19861): at java.lang.Runtime.loadLibrary(Runtime.java:366)
E/AndroidRuntime(19861): at java.lang.System.loadLibrary(System.java:988)
E/AndroidRuntime(19861): at net.sqlcipher.database.SQLiteDatabase$1.loadLibraries(SourceFile:219)
E/AndroidRuntime(19861): at net.sqlcipher.database.SQLiteDatabase.loadLibs(SourceFile:236)
E/AndroidRuntime(19861): at net.sqlcipher.database.SQLiteDatabase.loadLibs(SourceFile:215)
E/AndroidRuntime(19861): at net.sqlcipher.database.SQLiteDatabase.loadLibs(SourceFile:208)
E/AndroidRuntime(19861): at com.udemy.android.dao.DBHelper.(SourceFile:31)
E/AndroidRuntime(19861): at com.udemy.android.dao.DBHelper.getInstance(SourceFile:48)
E/AndroidRuntime(19861): at com.udemy.android.UdemyApplication.c(SourceFile:167)
E/AndroidRuntime(19861): at com.udemy.android.UdemyApplication.onCreate(SourceFile:106)
E/AndroidRuntime(19861): at com.udemy.android.CombinedApplication.onCreate(SourceFile:49)
E/AndroidRuntime(19861): at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1019)
E/AndroidRuntime(19861): at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4991)
E/AndroidRuntime(19861): at android.app.ActivityThread.access$1600(ActivityThread.java:177)
E/AndroidRuntime(19861): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1491)
E/AndroidRuntime(19861): at android.os.Handler.dispatchMessage(Handler.java:102)
E/AndroidRuntime(19861): at android.os.Looper.loop(Looper.java:135)
E/AndroidRuntime(19861): at android.app.ActivityThread.main(ActivityThread.java:5910)
E/AndroidRuntime(19861): at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime(19861): at java.lang.reflect.Method.invoke(Method.java:372)
E/AndroidRuntime(19861): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1405)
E/AndroidRuntime(19861): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1200)
Hello sir. I am quite new with android studio.
I have built the project without error.
Also have sync the gradle file with the project successfully.
But when I try to run the Android Studio project, it shows error.
It says that there is no APK file build for the project even though I have build the APK for the project
It also cannot find ID for the project
what should I do?
Please use URLEncoder.encode when you put data to http get request.
Without this your app can crash when you put special char or space.
Problem in files:
Error:A problem occurred configuring project ':app'.
Consult IDE log for more details (Help | Show Log)
what is the reason for this error in android studio?
public OnClickListener guessButtonListener = new OnClickListener() {
@Override
public void onClick(View v) {
Button guessButton = ((Button) v);
String guess = guessButton.getText().toString();
String answer = getCountryName(correctAnswer);
++totalGuesses; // increment number of guesses the user has made
if (guess.equals(answer)) { // if the guess is correct
++correctAnswers; // increment the number of correct answers
// display correct answer in green text
answerTextView.setText(answer);
disableButtons(); // disable all guess Buttons
// if the user has correctly identified FLAGS_IN_QUIZ flags
if (correctAnswers == FLAGS_IN_QUIZ) {
// DialogFragment to display quiz stats and start new quiz
DialogFragment quizResults =
new DialogFragment() {
// create an AlertDialog and return it
@Override
public Dialog onCreateDialog(Bundle bundle) {
AlertDialog.Builder builder =
new AlertDialog.Builder(getActivity());
builder.setMessage(
getString(R.string.results,
totalGuesses,
(1000 / (double) totalGuesses)));
// "Reset Quiz" Button
builder.setPositiveButton(R.string.reset_quiz,
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog,
int id) {
resetQuiz();
}
}
);
return builder.create(); // return the AlertDialog
}
};
hello sir,
i am creating android studios project and opening google translator webpage. i want to enter a string from previous window to the textbox of google translator webpage. please help me to find a solution
#define _GNU_SOURCE#include <pthread.h>#include <stdio.h>#include <stdlib.h>#include <fcntl.h> #include <netinet/ip.h> #include <sys/mman.h>#include <sys/uio.h>#include <sys/types.h>#include <sys/socket.h>#include <sys/stat.h> #define INADDR_LOOPBACK (0x7f000001) /* 127.0.0.1 */ unsigned long kill_switch = 0; #define MMAP_START (0x40000000)#define MMAP_SIZE (0x1000)#define MMAP_BASE(i) (MMAP_START + (i) * MMAP_SIZE)#define NR_MMAPS (512)enum mmap_status_t { MMAP_MAPPED = 0, MMAP_UNMAPPED};struct mmap_info_t { size_t base; size_t len; void * vaddr; enum mmap_status_t status;};struct mmap_info_t mmap_info[NR_MMAPS];pthread_t mmap_thread;static struct iovec mmap_iov[NR_MMAPS]; #define NR_PIPES (1)#define MAX_RACE_SECS (5)struct pipe_pair_t { int fd [ 2 ];};struct pipe_pair_t pipes[NR_PIPES];pthread_t pipe_read_threads[NR_PIPES];pthread_t pipe_write_threads[NR_PIPES]; #define NR_SOCKS (1000)pthread_t sendmmsg_threads[NR_SOCKS]; static inline void init_mmap(){ int i; for (i = 0; i < NR_MMAPS; i++) { mmap_info[i].base = MMAP_BASE(i);mmap_info [i]. len = MMAP_SIZE; mmap_info[i].vaddr = mmap( (void *)mmap_info[i].base, mmap_info[i].len, PROT_EXEC | PROT_READ | PROT_WRITE, MAP_SHARED | MAP_FIXED | MAP_ANONYMOUS, -1, 0 ); if (mmap_info[i].vaddr == (void *)-1) { perror("mmap failed"); exit(1); } mmap_iov[i].iov_base = mmap_info[i].vaddr; switch(i) { case 0:mmap_iov [i]. iov_len = 0 ; break; case 1:mmap_iov [i]. iov_len = 32 ; break; default:mmap_iov [i]. iov_len = 8 ; } } return;} static inline void init_pipes(){ int i; for (i = 0; i < NR_PIPES; i++) { if (pipe(pipes[i].fd) == -1) { perror("pipe failed"); exit(1); } } return;} int server_sockfd;struct sockaddr_in sk_client;#define UDP_SERVER_PORT (5105)struct iovec msg_iovecs[NR_MMAPS];size_t target_addr = 0xffffffc001e3c0c4UL;static inline void init_sock(){ int i; struct sockaddr_in server; server_sockfd = socket (AF_INET, SOCK_DGRAM, 0 ); if (server_sockfd == -1) { perror("socket failed"); exit(2); } server. sin_family = AF_INET;
Gradle sync failed: Unsupported method: SyncIssue.getMultiLineMessage().
The version of Gradle you connect to does not support that method.
To resolve the problem you can change/upgrade the target version of Gradle you connect to.
Alternatively, you can ignore this exception and read other information from the model.
Consult IDE log for more details (Help | Show Log) (35 s 309 ms)
how to solve this problem?thank you
if i try this command in terminal : cd c:/username:/appdata/local/Android/platform-tools
c:/username:/appdata/local/Android/platform-tools>adb nodaemon server
the problème resolve but it should do this evrytime i create a new project
ERROR: Failed to resolve: com.android.support.appcompat-v7:28.0.0:
Affected Modules: app
below is my gradle file
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.example.pa"
minSdkVersion 23
targetSdkVersion 28
// useLibrary 'android.test.runner'
// useLibrary 'android.test.base'
// useLibrary 'android.test.mock'
// buildToolsVersion '28.0.3'
versionCode 1
versionName "3.4.2"
// versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support.appcompat-v7:28.0.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
testImplementation 'junit:junit:4.12'
implementation 'androidx.annotation:annotation:1.0.0'
androidTestImplementation 'androidx.test:runner:1.1.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0'
implementation 'com.google.android.material:material:1.0.0'
implementation 'com.android.support:support-v4:28.0.0'
implementation 'com.google.firebase:firebase-core:17.0.0'
implementation 'com.google.android.material:material:1.1.0-alpha07'
}
apply plugin: 'com.google.gms.google-services'
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.