Posts by Thiago Luiz Domacoski • 7,310 points
323 posts
-
0
votes1
answer103
viewsA: Linearlayout with 2 textViews to simulate a button
Hello! You can add the click programmatically! To do this you must add an id to your Linearlayout and instantiate in your class: Follow an example: xml <LinearLayout…
-
1
votes1
answer912
viewsA: How to rotate imageView 90º?
Try The Next! First let’s turn one Drawable in Bitmap: public static Bitmap drawableToBitmap (Drawable drawable) { Bitmap bitmap = null; if (drawable instanceof BitmapDrawable) { BitmapDrawable…
-
1
votes1
answer341
viewsA: Pass the name of the item clicked on Listview Android
Hello! The same way you pass the id, you can pass name: Intent it = new Intent(layout_projetos_c.this, layout_projetos_c_info.class); it.putExtra("idProjeto", 10); it.putExtra("nomeDoProjeto", "Este…
-
2
votes1
answer170
viewsQ: Problem updating appcompat-v7
Hello I have a project that is using the version 23.1.0 library com.android.support:appcompat-v7. I was upgrading to 23.1.1 and the following error occurred: Failed to resolve:…
-
2
votes2
answers2948
viewsA: Error: "Cannot make a Static Reference to the non-static method from *"
Occurs the following : ps.setString(1, UsuarioModel.getNome()); This method is not static: I believe what you wanted to do is save one UsuarioModel , correct? Then you must pass it in the parameter!…
javaanswered Thiago Luiz Domacoski 7,310 -
2
votes1
answer1618
viewsA: Split layout in 2 columns
You can use weight: layout_weight= "1" If the elements have the same weight, they will have the same size. Example: <LinearLayout android:orientation="horizontal"…
-
3
votes1
answer541
viewsA: Type of android keyboard, text and number
Try the following: android:inputType="textCapCharacters" According to the documentation: Can be combined with text and its variations to request capitalization of all characters. Follow the link…
-
0
votes1
answer77
viewsA: Android - Sharedpreferences
Every time Activity is destroyed, data is removed: @Override protected void onDestroy() { super.onDestroy(); sharedPreferences = getSharedPreferences(PREF_NAME, MODE_PRIVATE);…
androidanswered Thiago Luiz Domacoski 7,310 -
0
votes2
answers120
viewsA: spinner change image cause error: Out of Memory on a byte allocation
Try it like this: if("A".equals(escolha)) { ImageView imgf = (ImageView) findViewById(R.id.mapView); imgf.setImageResource(R.drawable.img_a); } When using == compare if the reference is equal. And…
-
1
votes1
answer747
viewsA: Android studio create directories
You can add in the Assets folder, and there create subdirectories To load from the Assets folder: try { // carrega a imagem InputStream ims = getAssets().open("pasta1/img1.jpg"); // Transforma em…
androidanswered Thiago Luiz Domacoski 7,310 -
1
votes1
answer97
viewsA: Manipulating android imageView
Try it like this : ImageView img= (ImageView) findViewById(R.id.image_id); img.setImageResource(R.drawable.nova_imagem); Or ImageView img= (ImageView) findViewById(R.id.image_id); Bitmap bitImage =…
-
1
votes2
answers307
viewsA: Listview duplicating data in android app
Try it like this: protected void onPreExecute() { super.onPreExecute(); pd = new ProgressDialog(context); pd.setTitle("Buscando dados...."); pd.setMessage("Aguarde!!"); pd.setCancelable(true);…
-
2
votes1
answer137
viewsQ: Parameters via xml for custom Imageview
I have a ImageView customized, which will function as a Switch. On the screen, I will have several of this item, but of different colors. I wonder if it is possible to pass a color parameter in the…
-
3
votes1
answer2043
viewsQ: Is there a keyword rule in Google Play?
How keywords work in Google Play? Is there any way to enter keywords? Or it uses the description of the App?
-
2
votes1
answer1896
viewsA: Android: getApplicationContext()
can pass via parameter: getData(ApplicationContext appContext) getApplicationContext() is an Activity method, so it only exists in Activity Extended Classes (Appcompatactivity, Actionbaractivity,…
-
2
votes1
answer186
viewsA: Error android.database.sqlite.Sqliteexception
If you add the parameters in SQL (sqliteHelper.EMAIL + " = '" + email + ), there is no need for the second parameter in the rawQuery. Example: Cursor cursor = abrirBanco().rawQuery("SELECT * FROM "…
-
0
votes0
answers555
viewsQ: Generate image with text
I would like to generate images with dynamic texts! public void generate() { Bitmap src = BitmapFactory.decodeResource(getResources(), R.mipmap.ic_launcher); Bitmap dest = Bitmap.createBitmap(500,…
-
1
votes1
answer705
viewsA: Copy file content in Assets directory to existing Android file
Try it like this: /** * Em caso de erro retorna um IOException * Esta exeçnao deve ser tratada onde é chamado * @return * @throws IOException */ public String Listar () throws IOException{ final…
androidanswered Thiago Luiz Domacoski 7,310 -
0
votes1
answer169
viewsA: Appbar overlapping the content of the rest of Activity
Try it this way: <?xml version="1.0" encoding="utf-8"?> <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:layout_margin="1dp"…
-
0
votes1
answer96
viewsQ: Problem loading Maps v2
Good morning! I have the following code to load the map in my application: if (mMap == null){ mMap = ((SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map)).getMap(); if(null…
-
1
votes1
answer574
viewsA: How to read file that is inside the . apk?
Hello! You must put in the Assets folder! Here’s an example of how to load the file: /** * Carrega um arquivo txt */ private void load(){ try { final InputStream inputStream =…
androidanswered Thiago Luiz Domacoski 7,310 -
2
votes1
answer1841
viewsA: Change Fragment from click
In your Activity create a method this way: public void openFragment() { Fragment fr = new Fragment(); FragmentManager fm = getFragmentManager(); FragmentTransaction fragmentTransaction =…
androidanswered Thiago Luiz Domacoski 7,310 -
1
votes1
answer91
viewsA: How to pass the contents of a String (which I took from View.toString() to a View?
Here’s an example of how to save the List to Sharedpreferences: // Constante com o nome do objeto q vamos salvar private static final String LISTA = "LISTA"; // Constante com o nome da propriedade…
androidanswered Thiago Luiz Domacoski 7,310 -
1
votes1
answer359
viewsA: Save Edittext and Datepicker in Shared Preferences
Try The Next: //SALVA OS DADOS: //TAG: é o ID para resgatar o valor //VALUE: o valor a ser armazenado private void makeTag(final String tag, final String value){ SharedPreferences.Editor…
androidanswered Thiago Luiz Domacoski 7,310 -
5
votes2
answers2368
viewsA: How to use "Biginteger" type to solve this problem?
I’m not sure I understand your doubt correctly, Follow what I understand what you want to do: import java.math.BigInteger; public class Graos { public static BigInteger numeroGraos(int…
javaanswered Thiago Luiz Domacoski 7,310 -
2
votes2
answers599
viewsQ: Click on a Menu, and change the icon of the others
Good afternoon, my question is this:: I have a submenu, where the user will select the map Layer. These Submenu’s will have an image of check in to indicate which one is selected. Follows the xml:…
-
0
votes1
answer379
viewsA: Animate the Actionbar button
I managed to solve as follows: Includes the image inside a LinearLayout and worked properly. Follow the updated code: As I will use on multiple screens, I created an abstract class to take care of:…
-
0
votes2
answers300
viewsA: I am not able to store the correct information of a Radio Button in the database
Hello try to change the following part of the code: if (publico.getText().toString() == hospital_publico ) { nameValuePairs.add(new BasicNameValuePair("tipo", hospital_publico)); }else{…
-
0
votes1
answer379
viewsQ: Animate the Actionbar button
Good afternoon, I have an app that has a refresh button on Actionbar : <menu xmlns:android="http://schemas.android.com/apk/res/android"…
-
2
votes2
answers1323
viewsA: Save Checkbox Values in Android Studio
You can save in the database, or use SharedPreferences, that I believe is the simplest way: To make it easier, I recommend creating a class that contains the values I wanted to save: class Valores {…
-
1
votes6
answers18836
viewsA: Removing Titlebar from the android app
In your file styles.xml comes with a default theme: <!-- Base application theme. --> <style name="AppTheme" parent="Theme.AppCompat.Light"> <!-- Customize your theme here. -->…
-
1
votes1
answer140
viewsA: How to center my location by clicking on a Marker?
Follows: LatLng isMe = new LatLng(mMap.getMyLocation().getLatitude(), map.getMyLocation().getLongitude()); final CameraPosition position = new CameraPosition(isMe, ZOOM_APROXIMADO,…
-
1
votes1
answer92
viewsA: Android Animate object height
slide_up.xml: <?xml version="1.0" encoding="utf-8"?> <set xmlns:android="http://schemas.android.com/apk/res/android" > <translate android:duration="1000" android:fromYDelta="100%"…
-
1
votes1
answer31
viewsA: Remove the action from the Optionsmenu’s physical button
I was able to solve my problem by writing the following method: onMenuOpened : @Override public boolean onMenuOpened(int featureId, Menu menu) { return false; } This method is invoked only when I…
androidanswered Thiago Luiz Domacoski 7,310 -
0
votes1
answer31
viewsQ: Remove the action from the Optionsmenu’s physical button
We have an application in which we are removing the action of OptionsMenu of the physical button and inserting in the Toolbar. I wonder if it is possible to undo the action of the physical Menu…
androidasked Thiago Luiz Domacoski 7,310 -
0
votes1
answer38
viewsA: Canvas: Density Pixels to draw images
It goes on as I resolved: DisplayMetrics metrics = new DisplayMetrics(); getWindowManager().getDefaultDisplay().getMetrics(metrics); Integer _SizePin = Math.round( Float.valueOf(100)*…
-
0
votes1
answer38
viewsQ: Canvas: Density Pixels to draw images
Good afternoon ! I’m creating a custom Marker for the map: final Bitmap markerIcon = Bitmap.createBitmap(275, 275, Bitmap.Config.ARGB_8888); final Paint paint = new Paint(); final Canvas canvas =…
-
1
votes1
answer167
viewsQ: Import dependency google-api-client
Good morning! I’m trying to matter google-api-java-client of github for my Android project; I’m using the AndroidStudio, and follow my build.Lade apply plugin: 'com.android.application' apply…
-
5
votes1
answer680
viewsA: How to Implement Navigation Drawer with Map in a Fragment
I had this problem too! Follow below as I’ve managed: Activity: public class MapsActivity extends AppCompatActivity { private DrawerLayout mDrawerLayout; private ListView mListDrawer; private…
androidanswered Thiago Luiz Domacoski 7,310 -
0
votes2
answers205
viewsA: How to display the result of an operation in Android?
For this you must use TextWatcher: The example below concatenates the two String in the third Edittext: TextWatcher textWatcher = new TextWatcher() { @Override public void…
androidanswered Thiago Luiz Domacoski 7,310 -
1
votes2
answers103
viewsQ: Start service through user action
Good morning! I have an app that will receive Pushnotification. But the user will be able to select whether or not to receive notifications. I have a WakefulBroadcastReceiver and a IntentService…
-
1
votes1
answer733
viewsA: How to "delete" an image from the screen
Try it this way: g.clearRect(x, y, width, height); Clears the specified rectangle by filling it with the background color of the current drawing surface. This operation does not use painting mode…
-
5
votes1
answer826
viewsA: Pass object for error parameter - Android Studio
In order to pass an object as parameter it is necessary that it be Serialized, ie implement Serializable. Follow a simple example: Class: public class Params implements Serializable{ public String…
-
1
votes1
answer138
viewsA: Does the GCM deliver the messages in real time?
Follow what the documentation says: Send a message. The application server sends messages to the client application: The application server sends a message to the GCM connection servers. The GCM…
androidanswered Thiago Luiz Domacoski 7,310 -
0
votes2
answers570
viewsA: List of all installed applications
Follows: PackageManager packageManager=getPackageManager(); List<ApplicationInfo> list = packageManager.getInstalledApplications(PackageManager.GET_META_DATA); List<String> values = new…
androidanswered Thiago Luiz Domacoski 7,310 -
8
votes1
answer393
viewsA: onClick on dynamic button causes error "Cannot resolve constructor Intent"
The context when implementing a class changes: btnJogarNovamente.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Intent it; it = new Intent(this,…
-
1
votes1
answer685
viewsA: How to read the return of the json webservice (WEBSERVICE - JSON)
Only decrease JSON to test: String s = "{ \"articleList\": { \"conversas\": [ { \"cd_resultadofinanceiro\": \"24\" }, {\"cd_resultadofinanceiro\": \"18\"}]}}"; try { JSONObject jsonObject = new…
-
0
votes1
answer139
viewsA: Smsmanager sending SMS
I was able to send it the following way: smsManager.sendMultipartTextMessage(phone, null ,smsManager.divideMessage(textmessage), null, null); Greetings
-
0
votes1
answer139
viewsQ: Smsmanager sending SMS
I’m trying to send a text with the following code: final SmsManager smsManager = SmsManager.getDefault(); smsManager.sendTextMessage("phone", null, "Message", null, null); But nothing happens, it…
-
1
votes2
answers56
viewsA: Webview does not want to go downtown
Follow a simple example: <WebView android:layout_width="match_parent" android:layout_height="match_parent" android:layout_gravity="center_vertical" android:id="@+id/webView2"…