android,google-maps,android-studio,google-play-services,google-play-developer-api
If you are using Android Studio open the build.gradle file and enter inside dependencies dependencies { compile 'com.google.android.gms:play-services:4.2.+' } more info Add Google Play Services to Your Project...
android,ios,documentation,realm
If you look at the top of the webpage that you linked it says: Install in Dash. Dash is an app in App Store: https://itunes.apple.com/ro/app/dash-api-docs-snippets/id458034879?mt=12 that let's you view documentation offline....
android,gradle,android-version
You could have two versions of the application in Play store. However, you would have to maintain these separately and it is frustrating to upgrade from free to paid with this approach. If you chose this way of maintaining your application, you would have to have two projects, one for...
android,logging,error-handling,sdk,production
Flurry analytics crashlytics They will give you the logs and errors in production app..I think this will suits you well...
So I have found the solution at this http://www.alonsoruibal.com/my-gradle-tips-and-tricks/. The trick is in your Java Library module's build.gradle file you need to include the following. apply plugin: 'java' sourceCompatibility = 1.6 targetCompatibility = 1.6 Wrong Java Compiler When Including a Java Module as Dependency in Android Studio...
You just need to care about tag Ads: 06-22 19:18:17.207 20075-20110/nocompany.CashingCash W/Ads﹕ There was a problem getting an ad response. ErrorCode: 2 Because of sometimes Google Admob does not work well then it is not successful in loading the advertisement. Make sure that you have a good internet connection and...
You didn't create setName() method in Person class. public class Person { private String name; private String country; private String twitter; //getters & setters.... public void setName(String pName) { this.name = pName; } public void getName() { return this.name; } } ...
Use following code to delete set alarm. Hope this will help you Intent myIntent = new Intent(context,VisitReminderNotificationMessage.class); PendingIntent pendingIntent = PendingIntent.getService(context, id, myIntent, PendingIntent.FLAG_UPDATE_CURRENT); AlarmManager alarmManager = (AlarmManager) context.getSystemService(VisitReminderNotificationMessage.ALARM_SERVICE); alarmManager.cancel(pendingIntent); pendingIntent.cancel(); ...
You don't want to use it from assets, even if you could, because assets is a compressed read only file, part of your installation. You can't write updates into it, which kills 90% of database use. And its inefficient for reading as its zipped up. So you really do need...
The indexOf method doesn't accept a regex pattern. Instead you could do a method like this: public static int indexOfPattern(List<String> list, String regex) { Pattern pattern = Pattern.compile(regex); for (int i = 0; i < list.size(); i++) { String s = list.get(i); if (s != null && pattern.matcher(s).matches()) { return...
Looks like you are adding it inside a mapview as from above image: use this and change the features according to your requirement static final LatLng MELBOURNE = new LatLng(-37.81319, 144.96298); Marker melbourne = mMap.addMarker(new MarkerOptions() .position(MELBOURNE) .title("Melbourne") .snippet("Population: 4,137,400")); Refer this link: link...
Correct me if I'm wrong. If you're saying that your code looks like this: new Thread(new Runnable() { public void run() { // thread code if (ready.equals("yes")) { // handler code } // more thread code }).start(); // later on... ready = "yes"; And you're asking why ready = "yes"...
java,android,sqlite,android-sqlite,sqliteopenhelper
you should copy the .db file from your assets folder to an internal/external storage. You can use following codes, private static String DB_PATH = "/data/data/your package/database/"; private static String DB_NAME ="final.db";// Database name To create a database, public void createDataBase() throws IOException { //If database not exists copy it from...
android,android-annotations,greenrobot-eventbus
You have three options: Use Otto. It also has the same problem what you faced with EventBus, however AndroidAnnotations has specific Otto integration which solves that problem. If you want to stick with EventBus, you can try out the experimental version, which does not has the issue as 2.4.0. It...
android,android-studio,twitter4j
Try to use the following configuration: ConfigurationBuilder cb = new ConfigurationBuilder(); cb.setOAuthAuthenticationURL("https://api.twitter.com/oauth/request_token"); cb.setOAuthAccessTokenURL("https://api.twitter.com/oauth/access_token"); cb.setOAuthAuthorizationURL("https://api.twitter.com/oauth/authorize"); cb.setOAuthRequestTokenURL("https://api.twitter.com/oauth/request_token"); cb.setRestBaseURL("https://api.twitter.com/1.1/"); cb.setOAuthConsumerKey(consumerKey);...
Try clearing your prefs (in onCreate), before setting defaults: PreferenceManager.getDefaultSharedPreferences(this).edit().clear().commit(); PreferenceManager.setDefaultValues(this, R.xml.preferences, true); From the PreferenceManager.setDefaultValues() documentation: Note: this will NOT reset preferences back to their default values. For that functionality, use getDefaultSharedPreferences(Context) and clear it followed by a call to this method with this parameter set to true. ...
android,hashmap,sharedpreferences
Please check As i added the full code of my MainActivity.java file as follows: public class MainActivity extends ListActivity { HashMap<String, Rajdata> map; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); map = new HashMap<String, Rajdata>(); for (int i = 0; i < 10; i++) { Rajdata raj = new...
android,listview,recyclerview,navigationview
You can just nest the ListView or RecyclerView inside the NavigationView. <?xml version="1.0" encoding="utf-8"?> <android.support.v4.widget.DrawerLayout android:id="@+id/drawer_layout" xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:fitsSystemWindows="true" tools:context=".MainActivity"> <FrameLayout...
android,search-suggestion,custom-search-provider
Intent action names are case sensitive. Use this: android.intent.action.VIEW ...
android,android-intent,bluetooth,android-bluetooth,bluetooth-oob
You are being prompted for entering the pin because that is what you are requesting in your pairingIntent. Instead of using pairingIntent.putExtra(BluetoothDevice.EXTRA_PAIRING_VARIANT, BluetoothDevice.PAIRING_VARIANT_PIN); pairingIntent.putExtra(BluetoothDevice.EXTRA_PAIRING_KEY, 1234); Use pairingIntent.putExtra(BluetoothDevice.EXTRA_PAIRING_VARIANT, PAIRING_VARIANT_PASSKEY_CONFIRMATION); As mentioned here, The user will be prompted to confirm the passkey displayed on the screen or an app will confirm the...
All the information you need is right here, before your eyes. No resource identifier found for attribute 'scalteType' in package 'android' There is no attribute called "scalteType" in ImageView. Find it in the layout file 'main.xml' and change to "scaleType"....
android,facebook,facebook-graph-api
Use the loginManager to add more permission. you can add it on click button or on create view or fragment LoginManager.getInstance().logInWithReadPermissions( fragmentOrActivity, Arrays.asList("user_friends")); You can also get AccessToken via following if needed after getting new permission AccessToken.getCurrentAccessToken() ...
Start with studio When starting with studio will be confusing but don't worry I think this may help you Start a project Writing a layout first decide the layout for the app for scrollable apps use Writing java this is main part here you can do wherever you want to...
android,android-service,android-wear,google-api-client,android-wear-data-api
override onCreate in your Service, and put the initialization of mGoogleApiClient in it private GoogleApiClient mGoogleApiClient; public void onCreate() { super.onCreate(); mGoogleApiClient = new GoogleApiClient.Builder(this) .addApi(Wearable.API) .build(); } ...
You can use an if on the result. If mysql_query() fails it returns false: $result = mysql_query(/*the query*/); if(!$result){ //Do stuff here, the query failed //json_encode() } else { //Query succeeded } Sidenote: mysql_* is deprecated, I highly recommend to switch to mysqli_* or PDO...
Replace the below line in the getContacts() mehod contact_list = qb.query(); with List<ContactLists> temp = qb.query(); contact_list.clear(); contact_list.addAll(temp); because the you changing the reference of the list....
First of all, a user can't enter text on a TextView. You'll need an EditText for that. You already have EditText in your layout file, so initialize them like so EditText usernameEditText= (EditText) findViewById(R.id.userloginname); EditText passwordEditText = (EditText) findViewById(R.id.userpassword); Then inside your onClick() method public void onClick(View v) { String...
android,service,android-textview
We can achieve by using handler,broadcat and Listener concept.But I think broadcast is easy to implement and understand but need to take care or register and unregister of broadcast. USING LISTENER Create a Listener class public Interface Listener{ public void onResultReceived(String str); } Now implement it in activity like below...
open project.properties file in a text editor and remove the line which was related to appcompat. Then I managed to import the project without errors. After successful import, I added appcompat as a dependency Android Studio: Android Manifest doesn't exists or has incorrect root tag Migrating From Eclipse Projects http://tools.android.com/tech-docs/new-build-system/migrating-from-eclipse-projects...
After the API 1.5.6 we have a different way to get the String bound. try this GlyphLayout layout = new GlyphLayout(); layout.setText(bitmapFont,"text"); float width = layout.width; float height = layout.height; and it's not recommended to create new GlyphLayout on each frame, create once and use it. ...
java,android,illegalstateexception,broken-pipe
When you execute the command os.writeBytes("exit\n"); this ends your su session. The su process ends itself and the pipe your are using for writing commands to the su shell gets broken. Therefore if you want to execute another command you have to restart a new su session or do not...
All you need to do is to call finish() inside onActivityResult(). This will destroy that activity once the share is completed. For example: @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { callbackManager.onActivityResult(requestCode, resultCode, data); finish(); //destroys the activity } ...
android,android-viewpager,recyclerview,fragmentpageradapter
Do not use any fragments on any recycling views like list view, recycler view etc. Fragments are attached to its container, in recycler view container will be changed frequently, as it is getting recycled. It will trouble later. Better you can change the view pager to vertical scrolling view pager....
Nag and Maisse already provided you proper answers but if these answers not working try this. Check in style.xml to know which theme are you using for your activity. <!-- Base application theme. --> <style name="AppTheme" parent="android:Theme.AppCompat.Light.DarkActionBar"> <!-- Customize your theme here. --> </style> to <!-- Base application theme. -->...
android,mqtt,mosquitto,libmosquitto
A topics is only "created" when something is published to it the first time. There is no mechanism to detect this apart from subscribing to a wildcard topic that would match all topics of interest and triggering processing when the first message is received on a given topic. In the...
On the link you post, I see a class like below. Create this class in your project before using it. private class AsyncCallWS extends AsyncTask<String, Void, Void> { @Override protected Void doInBackground(String... params) { Log.i(TAG, "doInBackground"); getFahrenheit(celcius); return null; } @Override protected void onPostExecute(Void result) { Log.i(TAG, "onPostExecute"); tv.setText(fahren +...
It looks like you just need to set your local reference of imageInformationList in the constructor of your ImageAdapter class. Since you never set it to the reference that is passed into the constructor, it is still null when you call imageInformationList.get(position).getImg() inside getView(). To fix it, just assign the...
android,android-audiomanager,ondestroy
Use a service like: public class FirstService extends Service { private AudioManager audioManager; @Override public IBinder onBind(Intent arg0) { return null; } @Override public void onDestroy() { super.onDestroy(); audioManager.setSpeakerphoneOn(false); //Turn of speaker } } public void onDestroy () Added in API level 1 Called by the system to notify a...
Try like this... public View getView(int poisition, View convertView , ViewGroup parent) { ViewHolder crimeHolder = null; //If we weren't given a view, inflate one if (convertView == null) { convertView = getActivity().getLayoutInflater().inflate(R.layout.list_item_crime, null); crimeHolder = new ViewHolder(); crimeHolder.titleTextView = (TextView)convertView.findViewById(R.id.listItemTitleTextView); crimeHolder.dateTextView = (TextView)convertView.findViewById(R.id.listItemDateTextView); crimeHolder.solvedCheckBox =...
No, sorry. If you hand bytes over to a third-party app, that third-party app can do what it wants with those bytes. So only solution is to use some in-app pdf reader right? This will not completely stop people from copying your PDFs. However, it will limit attacks to those...
android,xml,character-encoding,xmlpullparser,questionmark
Content encoding and character encoding are not the same thing. Content encoding refers to compression such as gzip. Since getContentEncoding() is null, that tells you there's no compression. You should be looking at conn.getContentType(), because the character encoding can usually be found in the content-type response header. conn.getContentType() might return...
You cannot write to resource files. They are read-only.
java,android,android-intent,uri,avd
Change your onClick method to below code. You should give the option to choose the external player. @Override public void onClick(View v) { Intent intent = new Intent(Intent.ACTION_VIEW); intent.setDataAndType(Uri.parse("https://youtu.be/jxoG_Y6dvU8"), "video/*"); startActivity(Intent.createChooser(intent, "Complete action using")); } ...
Try like this: Create a global variable like: private String name; then in "onCreateViewHolder" write like this: name= parent.getResources().getString(R.string.mac); now, in "onBindViewHolder" write like this: device.name.setText(name + data.macAddress); ...
http://android.okhelp.cz/draw-rect-android-basic-example/ http://alvinalexander.com/android/how-to-draw-rectangle-in-android-view-ondraw-canvas canvas.drawColor(Color.CYAN); Paint p = new Paint(); // smooths p.setAntiAlias(true); p.setColor(Color.RED); p.setStyle(Paint.Style.STROKE); p.setStrokeWidth(4.5f); canvas.drawRect(10, 10, 30, 30, p); ...
I executed ur code. Just add numberView.setTextColor(Color.BLACK); and it will work! :)...
MapsActivity is not a fragment and has been deprecated for years. You should instead follow the Getting Started with the Google Maps Android API which uses MapFragment - you can instead use SupportMapFragment if you want to use FragmentActivity.
java,android,eclipse,sdk,versions
There shouldn't be any problem if you use the latest SDK version ; actually, this is recommended. However, make sure to set the correct "Target SDK", i.e. the highest android version you have successfully tested your app with, and the "Minimum Required SDK" as well....
1) I think you might be able to use the Async task only once in the class. But definitely it can be called multiple times. 2) please check if your button onclicklistener() function is really getting called on button click. try some logs in that. because the code seems to...
I'm not sure what are you trying to do, are you trying to have the imageview to adapt to your image's size or are you trying to have your image view at a fixed size? When the image is shown on a xhdpi screen will the image be scaled to...
You could just use 1 button and change the image: <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal" android:background="#606060" android:padding="5dp" android:animateLayoutChanges="true" android:id="@+id/parent" > <ImageView android:id="@+id/toggleStep" android:src="@drawable/open" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginRight="5dp" android:onClick="toggle"...
android,github,gradle,libraries
You have add path to your aFileDialog library in your settings.gradle Make sure that folder you point to includes build.gradle file include ':app' include ':aFileDialog' project(':aFileDialog').projectDir = new File(settingsDir, 'aFileDialog') or (judging from the library folder structure on GitHub) project(':aFileDialog').projectDir = new File(settingsDir, 'aFileDialog/library') ...
android,android-layout,android-fragments
Try modifying the following line in you .xml file android:dropDownWidth="match_parent" to android:dropDownWidth="300dp" or wrap_content Hope this should help !...
android,listview,android-listview,android-arrayadapter,popupmenu
You Should re-populate the folderlist then call Notifydatasetchanged. fileNames = fileFunctions.listFileNames(Environment.getExternalStorageDirectory() + "/Documents/Files"); for(int i = 0; i < fileNames.length; i++){ folderList.add(new FolderBean(fileNames[i], "text")); } ...
What about the good old findViewById: View view = solo.getCurrentActivity().findViewById(R.id.logout_button); Assert.assertNotNull(view); solo.clickOnView(view); Edit: import android.test.ActivityInstrumentationTestCase2; import android.view.View; import com.robotium.solo.Solo; import junit.framework.Assert; public class MainActivityTest extends ActivityInstrumentationTestCase2<MainActivity> { private Solo solo; public MainActivityTest() { super(MainActivity.class); } @Override public void setUp() throws Exception { solo = new...
From https://source.android.com/devices/tech/dalvik/dalvik-bytecode.html: Because, in practice, it is uncommon for a method to need more than 16 registers, and because needing more than eight registers is reasonably common, many instructions are limited to only addressing the first 16 registers. When reasonably possible, instructions allow references to up to the first 256...
Try this code. adjustViewBounds attribute makes the ImageView the same size as image that you put in it. <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:adjustViewBounds="true" /> If you need specific width or height change the wrap_content value....
You need a FrameLayout. In a FrameLayout, the children are overlapped on top of each other with the last child being at the topmost. activity_main.xml <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" xmlns:fab="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="match_parent" android:fitsSystemWindows="true"> <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent"...
android,android-activity,android-studio,menu,menuitem
Option A A base Activity class that implements the logic for the menu items - in this case all 30 of your Activities should extend the base Activity. This approach has the serious limitation that it forces you to extend a class even though you may need to extend another...
There are multiple support libraries in your project. You can try below steps : Open your project folder in windows explorer(Windows)/finder(Mac). Check your project's libs folder and any support library's (such as appcompact_v7) libs folder. Check if you have multiple JAR files with same name. If you have multiple JAR...
java,android,listview,android-fragments,expandablelistview
You shouldn't pass your view item form a fragment to an other. You should retrieve the object associated with your group view, pass this object to your second/edition fragment. You can use setTargetFragment(...) and onActivityResult(...) to send the modified text from your second to your first fragment. And then you...
Include CalendarPickerView in your layout XML. <com.squareup.timessquare.CalendarPickerView android:id="@+id/calendar_view" android:layout_width="match_parent" android:layout_height="match_parent" /> In the onCreate of your activity/dialog or the onCreateView of your fragment, initialize the view with a range of valid dates as well as the currently selected date. Calendar nextYear = Calendar.getInstance(); nextYear.add(Calendar.YEAR, 1); CalendarPickerView calendar = (CalendarPickerView) findViewById(R.id.calendar_view);...
android,android-fragments,dagger-2
Your understanding is correct. The named scopes allow you to communicate intention, but they all work the same way. For scoped provider methods, each Component instance will create 1 instance of the provided object. For unscoped provider methods, each Component instance will create a new instance of the provided object...
android,android-intent,android-activity,bitmap
use following method..... **************************************************** Bitmap bm = ShrinkBitmap(imagefile, 300, 300); image.setImageBitmap(bm); Bitmap ShrinkBitmap(String file, int width, int height) { BitmapFactory.Options bmpFactoryOptions = new BitmapFactory.Options(); bmpFactoryOptions.inJustDecodeBounds = true; Bitmap bitmap = BitmapFactory.decodeFile(file, bmpFactoryOptions); int heightRatio =(int)Math.ceil(bmpFactoryOptions.outHeight/(float)height); int widthRatio =...
It's not possible to do this using only the ArrayList. Either implement your own method which can be as simple as: private List<mystatistik> getAllUniqueEnemies(List<mystatistik> list){ List<mystatistik> uniqueList = new ArrayList<mystatistik>(); List<String> enemyIds = new ArrayList<String>(); for (mystatistik entry : list){ if (!enemyIds.contains(entry.getEnemyId())){ enemyIds.add(entry.getEnemyId()); uniqueList.add(entry); } } return uniqueList; } Or...
android,android-layout,relativelayout,android-relativelayout
Please use LinearLayout and use this code, which will work in all resolutions device. <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:gravity="center_horizontal" > <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal" android:weightSum="3" > <ImageView android:id="@+id/icon1"...
android,android-fragments,android-asynctask
getFragmentManager() is a method of Activity, not Context. Since you're probably passing in an Activity as the context parameter anyway, you could hack this with: FragmentManager man = ((Activity) c).getFragmentManager(); but long term, best practice would be to pass either the Activity or the FragmentManager directly as an argument to...
Note that you are using the deprecated ActivityInstrumentationTestCase2 and that TestCases like ActivityInstrumentationTestCase2 or ServiceTestCase are deprecated in favor of ActivityTestRule or ServiceTestRule. So try switchwing to using the rules, which is actually pretty straightforward. Also, be sure to use the correct annotations. Check my other answer here to get...
android,android-activity,camera,photo
@Override public void onPictureTaken(byte[] data, Camera camera) { final Bitmap bitmap = BitmapFactory.decodeByteArray(data, 0, data.length); // Store bitmap to local storage FileOutputStream out = null; try { // Prepare file path to store bitmap // This will create Pictures/MY_APP_NAME_DIR/ File mediaStorageDir = new File(Environment.getExternalStoragePublicDirectory( Environment.DIRECTORY_PICTURES), "MY_APP_NAME_DIR"); if (!mediaStorageDir.exists()) { if...
java,android,xml,android-activity,android-listfragment
You are operating on the original data instead of filtered data. You should maintain a reference to original data and use the filtered data for all other purposes. So that the original data is displayed when search is cleared. Replace all usages of mData with mFilteredData as below and only...
android,android-mediaplayer,music
I think it's beacuse the Xperias have a different Walkman App. I tested with this intent and it works: com.sonyericsson.music.playbackcontrol.ACTION_TRACK_STARTED The intent extras are different, the track info is on a Map, you need to debug it and see what you neeed. A manifest from a Xperia Walkman App( in...
Short answer: "You can't get realtime without using an external solution, but it's pretty easy to add an external service like PubNub to make it happen." Long answer and source: http://www.quora.com/Is-it-possible-to-use-Parse-com-for-realtime-chat-like-Socket-io...
What would be a correct way for overwriting existing row? Specify a conflict resolution strategy, such as INSERT OR REPLACE INTO foo ... If the insert would result in a conflict, the conflicting row(s) are first deleted and then the new row is inserted....
android,android-fragments,asynchronous
getActivity() returning null is a perfectly valid scenario which you should expect as well. This happens because by creating anonymous Handler in your onCreateView you're referencing Fragment which was already detached from Activity (therefore getActivity() returns null). Same goes for your AsyncTask - if you're creating it as an anonymous...
Try this Working code Buttonclick to take camera dialog.show(); Add this inside Oncreate() captureImageInitialization(); try this it will work // for camera private void captureImageInitialization() { try { /** * a selector dialog to display two image source options, from * camera ‘Take from camera’ and from existing files ‘Select...
Please change your getCount() as @Override public int getCount() { // TODO Auto-generated method stub return texts.length(); } ...
android,google-play,publishing
here is detail provided by the google and for more details http://www.appmakr.com/blog/how-long-app-approved/ https://somethingididnotknow.wordpress.com/2014/03/11/how-long-does-it-take-for-the-google-play-store-to-publish-my-app-in-beta/ Android application approval process in playstore ...
android,google-maps,android-maps-v2
You are attempting to find a fragment before it exists. You indicate that the layout that has the fragment is fragment_example_map.xml. However, you are trying to find the map fragment before you inflate that layout file. This will not work. Beyond that, you appear to be trying to get at...
android,button,android-intent,share
Could anyone help ? Concatenate the six strings into one larger string, and share that larger string....
Do it like this RelativeLayout layout = new RelativeLayout(this); RelativeLayout.LayoutParams dateArea = new RelativeLayout.LayoutParams( RelativeLayout.LayoutParams.WRAP_CONTENT, 90); dateArea .addRule(RelativeLayout.ALIGN_PARENT_BOTTOM); ...
java,android,android-fragments,spannablestring
If LoginActivity is a fragment class then it would be okay is you use setOnClickListener on textview. But for fragment change you have to change Intent to fragmentTransaction, Use something like, textview.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { getFragmentManager().beginTransaction().replace(R.id.container, new LoginActivity() ).addToBackStack("").commit(); }); But, if you want to...
In your MainActivity.java at line no 34 you are trying to initialize some widget that is not present in your xml layout which you have set it in your setContentView(R.layout.... That;s why you are geting nullpointerexception. EDIT: change your setContentView(R.layout.activity_main) to setContentView(R.layout.fragment_main)...
Button and TextView are class names. When I type: private Button myButton; I create a reference to an object of type button that points to an empty address location. If I then instantiate an object as follows: myButton = new Button(); myButton will refer to a newly created Button object...
android,unit-testing,robolectric
Instead of putting the json in src/test/res/raw you might want to put it in src/test/resources/ and then you can use it ( with the latest build plugin and latest AS ) via getResource Be aware that there is a bug in older versions - you need to use AS from...
This looks like the problem : HashMap<String, Integer> valuesOfAngleUnits = new HashMap<String, Integer>(); public void setValuesOfAngleUnits(HashMap<String, Integer> valuesOfAngleUnits) { valuesOfAngleUnits.put("Arc minute", 0); valuesOfAngleUnits.put("Arc second", 1); valuesOfAngleUnits.put("Degree", 2); valuesOfAngleUnits.put("Gon", 3); valuesOfAngleUnits.put("Grad", 4); valuesOfAngleUnits.put("Mil (Nato)", 5); valuesOfAngleUnits.put("Mil (Soviet Union)", 6); valuesOfAngleUnits.put("Octant", 7);...
You can have more control of your content by placing your content in three divs and then use CSS to define the width and margins of your divs (columns). For Example this could be your CSS: .oneThird { float: left; margin-right: 2%; width: 32%; } .gridLast { margin-right: 0; }...
the solution for this as i know is to add the values of arabic/hebrew to string value file: <?xml version="1.0" encoding="utf-8"?> <resources> <string name="app_name">בלהבלה</string> <string name="splash_text"> בדיקה? </string> </resources> after adding to the file you can add the value to your text box like this: textBox.setText(getResources().getString(R.string.app_name)); i don't know what...
android,dynamic,android-arrayadapter,android-spinner
@Haresh Chhelana example is good, However if you want to show both name and code in spinner after selecting, check this out. List<Map<String, String>> items = new ArrayList<Map<String, String>>(); for (int i = 0; i < JA.length(); i++) { json = JA.getJSONObject(i); mapData = new HashMap<String, String>(); mapData.put("name", json.getString("Name")); mapData.put("code",...
After super.onCreate(savedInstanceState); insert setContentView(R.layout.YourLayout); you need to make a request to a server in another thread. It might look like public class LoginTask extends AsyncTask<Void, Void, String>{ private String username; private String password; private Context context; public LoginTask(Context context, String username, String password) { this.username = username; this.password = password;...
I have one way Create refresh method in your Adapter like public void refresh(ArrayList<Aviso> itemsw) { this.items = itemsw; notifyDataSetChanged(); } Now you just called this method from your Activity Aviso aviso = new Aviso(); aviso.setTitle("MMMMMMMMMMMMMMMMMMMMMM"); aviso.setDescription("Deskribapena"); aviso.setPubDate("Wed, 19 Mar 2016 12:40:00 GMT"); aviso.setDcDate("2016-03-19T12:40:00Z"); avisosList.add(aviso); adapter.refresh(avisosList); EDIT: To add the...
Issue here is, you are trying to get the value for the property named "x" but you have not defined what is "x" and what are the values for it. So in your case, we need to define the limit of "x" and "y" properties. So just replace ValueAnimator translate...
May be the activity is again loading that is onCreate() is called. So save the state and restore it. Use onSaveInstanceState() and onRestoreInstanceState(). Let me know whether it worked or not.
android,xamarin,monodroid,xamarin.forms,floating-action-button
Before the official support library came out I ported the FAB over. There is now a Xamarin.Forms sample in my GitHub repo that you can use: https://github.com/jamesmontemagno/FloatingActionButton-for-Xamarin.Android...
java,android,gps,geolocation,location
See my post at http://gabesechansoftware.com/location-tracking/. The code you're using is just broken. It should never be used. The behavior you're seeing is one of the bugs- it doesn't handle the case of getLastLocation returning null, an expected failure. It was written by someone who kind of knew what he was...