Posts by Leonardo Dias • 4,336 points
198 posts
-
2
votes1
answer2475
viewsA: Open external link inside the webview main page
You need to implement the shouldOverrideUrlLoading example: myWebView.setWebViewClient(new WebViewClient() { @Override public boolean shouldOverrideUrlLoading(WebView view, String url) { if…
-
2
votes2
answers76
viewsA: App stopping when using Location API
The error indicated is: blockingConnect should not be called in the main Activity Do the following, remove these lines from your onCreate: mGoogleApiClient = new GoogleApiClient.Builder(this)…
-
1
votes5
answers1896
viewsA: Change Button Background
You need to create a Selector and put it as background button. Example: <?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android"…
-
1
votes2
answers2168
viewsA: Compile and run project via command line
Android uses the Ant building system. So you can create a xml build. and archive build.properties for your project. You will need to create the xml build. file first however: android update project…
-
2
votes1
answer841
viewsA: Custom searchview
To do well customized like this, I advise making an Edittext. Example: <EditText android:id="@+id/home_search" android:hint="pesquisar por nome ou profissão" android:textSize="15sp"…
-
4
votes1
answer121
viewsA: How to recognize the native "back" button of the android device in an app.
By the method: @Override public void onBackPressed() { //aqui você controla o voltar fisico do aparelho }
androidanswered Leonardo Dias 4,336 -
2
votes1
answer530
viewsA: How to recover data from an HTML form opened in a Webview?
You need to add an interface when declaring webView. Example: WebView webView = (WebView) findViewById(R.id.webview); webView.addJavascriptInterface(new WebAppInterface(this), "Android"); Class code…
-
0
votes1
answer515
viewsA: App expect Alertdialog response to password
And if you call the next function only when the user gives the OK? Example: .setPositiveButton("OK", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int…
-
5
votes1
answer268
viewsA: Close two activities
Do it this way, when you move to the next Activity: Intent intent = new Intent(Activity2.this, Activity3.class); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);…
-
1
votes1
answer297
viewsA: After Sqlite my application stopped working
You are not initiating the bank and already making a request. For example: db = new DBHelper(this); Dbhelper class: public class DBHelper extends SQLiteOpenHelper { public DBHelper(){…
androidanswered Leonardo Dias 4,336 -
3
votes1
answer129
viewsA: Application to make emergency calls
have you declared this activity in your AndroidManifest.xml? You did not declare Activity Link on Androidmanifest.xml
-
1
votes2
answers129
viewsA: Silent applications
In the Eclipse: Window -> Preferences -> Android -> Lint Error Checking. In the list find an entry with the id Protected permission. Set the gravity to something more recent than error.…
-
1
votes1
answer1802
viewsA: How to create a text file on Android?
You need to check the permission: <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> Below is an example that saves text file on device. public void…
-
-1
votes3
answers506
viewsA: How to get the object focused on Android
You can have your class implement the Onfocuschangelistener, thus: public class MainActivity extends Activity implements OnFocusChangeListener { private EditText editText1, editText2; @Override…
-
3
votes3
answers172
viewsA: Blur effect on image
I use a very simple library to make these effects. https://github.com/wasabeef/Blurry To use it is very simple: Add to the statement: dependencies { compile 'jp.wasabeef:blurry:2.0.3' } After you…
androidanswered Leonardo Dias 4,336 -
3
votes3
answers525
viewsA: Standardization of "String Resources" nomenclature
I believe an official standard doesn’t really exist. I always look before starting the nomenclature, define what the purpose of the message, for example: <string…
androidanswered Leonardo Dias 4,336 -
1
votes1
answer185
viewsA: Call Activity after thread is executed
Just do it this way below: if (professor.getCodProfessor() != null){ Intent intent = new Intent(Login.this,Menu.class); startActivity(intent); }else{ Toast.makeText(Login.this, "Código professor nao…
-
5
votes1
answer61
viewsA: Check if a "String Resource" is being used in the project
To check in Eclipse, do the following: Right-click the project name and select Package explorer Select Android Tools Select Run Lint: Check for common Errors Now when you open your file xml…
-
7
votes1
answer277
viewsA: Update Textview on onResume
You should not be calling the super.onResume(); Try to do it that way: @Override public void onResume(){ super.onResume(); } Obligatorily, calling the @Override and the super.onResume…
-
0
votes2
answers784
viewsA: Listview with a button at the bottom of the android studio list
You should use a Float Button and isolate your Listview in a Linear Layout, example: <android.support.design.widget.FloatingActionButton android:id="@+id/fab" android:layout_width="wrap_content"…
-
1
votes1
answer340
viewsA: Button that overwrites all screens
To create a Float Button that works outside the app, you need to work with Service, it works as if it were a Broadcast that always works in background, IE, when the APP is closed or in the…
-
0
votes2
answers1486
viewsA: How to change the checkbox color of a Multiselectlistpreference
You need to create a selector that way: <?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_checked="true"…
-
2
votes1
answer295
viewsA: Error generating signed APK
Goes in your build.Radle file (inside the /app folder) and in your defaultConfig, add this line: multiDexEnabled true It’ll stay that way: defaultConfig { applicationId "br.com.package.example"…
-
0
votes2
answers316
viewsA: Ratingbar sending value to Textview android
You can use the call: ratingBar.getRating(); But this value is a Float, then just convert to String or use as Float.
androidanswered Leonardo Dias 4,336 -
0
votes3
answers414
viewsA: Custom dialog
In your file shape_modal_dialog, you need to add the following field: <corners android:radius="6dp"/>
-
5
votes1
answer707
viewsQ: Notification icon in Android 5.0
I’m creating a push notification system with firebase in my project. The code that generates the push is like this: notificationBuilder = new NotificationCompat.Builder(this)…
-
0
votes2
answers998
viewsA: Access specific gallery folder
Use that code: Intent intent = new Intent(Intent.ACTION_GET_CONTENT); Uri uri = Uri.parse(Environment.getExternalStorageDirectory().getPath() + "/myFolder/"); intent.setDataAndType(uri, "text/csv");…
androidanswered Leonardo Dias 4,336 -
1
votes2
answers102
viewsA: Adapter modified in real time
After deleting the desired item, you should add the following line: adapter.notifyDataSetChanged();
-
-1
votes1
answer64
viewsA: Check if it is the correct Fragment after the click (UI Test)
You need to do the following: FragmentManager fm = getSupportFragmentManager(); if (fm != null) { List<Fragment> fragments = fm.getFragments(); if(fragments != null){ for(int i =…
-
0
votes1
answer542
viewsA: Listview with dynamic height(without scroll)
You need to calculate the height of your listview according to the number of items, that’s it? I use this code: public void setListViewHeightBasedOnChildren(ListView listView) { ListAdapter…
-
0
votes2
answers63
viewsA: Conflict when using Gson + Facebook API
It goes in your file build grade., inside the directory /app and add the line multiDexEnabled false within the defaultConfig, example: defaultConfig { applicationId "com.exemple.exemple"…
-
1
votes1
answer26
viewsA: Swipelayout java android error. When I put, gives application error!
You can’t use twice the setContentView(); The first time you are declaring your layout, but the second time when you call the setContentView(webView); you’re destroying the first. You need to…
-
0
votes1
answer1220
viewsA: Error:(1, 0) Plugin with id 'com.android.application' not found when doing project sync
You need to check your root build.Radle, which is outside the /app folder. It has to be that way: buildscript { repositories { jcenter() } dependencies { classpath…
-
4
votes2
answers533
viewsA: Alertdialog from another class
Create a method in your separate class with the following parameters: public static void showAlert(Context context, String title, String message){ AlertDialog alertDialog = new…
-
0
votes2
answers138
viewsA: I am trying to extend Stringrequest from Volley package, but the import is not working, why?
Are you using the official Android Volley? The others are all obsolete. Use this import here, see if it solves: compile 'com.android.volley:volley:1.0.0'
-
3
votes1
answer644
viewsA: How to increase Alertdialog text size?
Use this code below to change the text size: AlertDialog dialog = new AlertDialog.Builder(this) .setTitle("Gasolina") .setMessage("Sua melhor opção é: ") .setPositiveButton("OK", null) .show();…
-
0
votes1
answer19
viewsA: Android URL - Incomplete path
Fala Guidupas, Why are you taking the getPath()? You can notice that if you print only the url already solves: System.out.println(url); Hugs.
-
1
votes1
answer141
viewsA: Android Button below a fixed-size Viewpager
Fala Renan, Probably not being displayed because you are using Linearlayout on your screen layout. Try to change it to Relativelayout that he will appear. Note: If it’s not that, you’d better post…
-
2
votes3
answers4673
viewsA: Pass data between Fragments
Fala Roger, To pass data between Fragments, do the following, the moment you use Fragmentmeneger you have to create a Bundle and pass together, example: Fragment myFrag = new MyFragment(); Bundle…
-
2
votes1
answer128
viewsA: How to create video through an image sequence?
Fala Cristian, You can use the Animation function of Android, for example: Create a file xml animation. <animation-list xmlns:android="http://schemas.android.com/apk/res/android"…
-
2
votes2
answers887
viewsA: Camera orientation with Surfaceview
Fala Vinithius, Try to do the following, right after that line: camera = Camera.open(); Add that line: camera.setDisplayOrientation(90); See if it solves your problem. Hugs.…
-
-1
votes1
answer754
viewsA: Java: Get name and serial number of cell phone connected to the computer
Fala Luís, The serial is simple, just call build, example: String deviceSerial; try { deviceSerial = (String) Build.class.getField("SERIAL").get(null); } catch (IllegalAccessException e) {…
javaanswered Leonardo Dias 4,336 -
1
votes1
answer333
viewsA: ERROR : Cursorindexoutofboundsexception
Fala Gabriel, Probably this happens because your table is still empty, try to do so: if(cursor.getCount() > 0){ String preco_unitario = cursor.getString(cursor.getColumnIndex(COL_3_PRICES)); }…
-
3
votes1
answer170
viewsA: Error "Element linear layout must be declared"
Layout files (Relativelayout and Linearlayout) should be inside the folder res/layout. In this drawable folder you place image and Drawable Resources files, for example: layer-list, Shape, selector…
-
1
votes2
answers908
viewsA: Map of Google Maps does not open after the app launched
Cleidimar, You need to create the Release Key HASH, you probably just created the debug. Then you change there the ip that the hash returns, and you get two, one of development and one of…
-
0
votes2
answers33
viewsA: Event listening in a lib
Fala Marcelo, You can create a Boolean variable (in Activity), and when you finish the Dialog process you change this variable to true. Does not solve? Hugs.
-
0
votes2
answers348
viewsA: Databinding error in Android Studio 2.1.2: package databinding does not exist
Fala Morpheus, Change that line: apply plugin: 'com.android.application' For that reason: apply plugin: 'com.android.databinding' And try to compile again. Hugs.…
-
-1
votes1
answer216
viewsA: Error with retrofit
Fala Roberto, Your problem is in Model, to get it in array mode, you are doing wrong in Retrofit: Would have to be: Callback<List<Model>> in place of: Callback<Model[]> Hugs.…
-
2
votes1
answer62
viewsA: How to view files. zip using java for android
Fala Drkill, It really gets kind of hard to understand what your doubt, how so visualize? You can dec a file, example: private boolean unpackZip(String path, String zipname){ InputStream is;…
-
0
votes2
answers79
viewsA: Android - How to access an Activity through a Papplet?
Fala Cristian, You tried with the startIntent? example: Intent intent = new Intent(this, Teste.class); startIntent(intent); Hugs.