タグ付けされた質問 「android」

AndroidはGoogleのモバイルオペレーティングシステムであり、デジタルデバイス(スマートフォン、タブレット、自動車、TV、Wear、Glass、IoT)のプログラミングまたは開発に使用されます。Androidに関連するトピックについては、android-intent、android-activity、android-adapterなどのAndroid固有のタグを使用します。開発やプログラミング以外の質問で、Androidフレームワークに関連する質問については、次のリンクを使用してください:https:// android.stackexchange.com。


7
SparseArrayとHashMap
HashMap整数キーを持つSparseArraysがs よりもはるかに優れている理由はいくつか考えられます。 のAndroidドキュメントには、SparseArray「従来の方法よりも一般的に遅い」と書かれていますHashMap。 HashMapsではなくSparseArrays を使用してコードを記述する場合、コードはMapの他の実装で動作し、Maps用に設計されたすべてのJava APIを使用できます。 HashMapsではなくSparseArrays を使用してコードを記述した場合、そのコードはAndroid以外のプロジェクトで機能します。 オーバーライド地図equals()とhashCode()のに対しSparseArrayません。 しかしHashMap、Androidプロジェクトで整数キー付きのを使用しようとすると、IntelliJはSparseArray代わりにを使用するように指示します。これは本当に理解するのが難しいと思います。誰かがSparseArrays を使用する説得力のある理由を知っていますか?

13
Androidでカウントダウンタイマーを作る方法は?
XMLに2つのEditTextがあります。あるEditTextでは、ユーザーは数値を分として入力し、別のEditTextでは数値を秒として入力できます。終了ボタンをクリックした後、秒数EditTextはカウントダウンを開始し、毎秒そのテキストを更新する必要があります。 さらに、それがゼロ分とゼロ秒になるまでそれを更新し続けることができますか?
177 android  timer  countdown 

18
EditTextにフォーカスを設定
EditText-Fieldがあり、OnFocusChangeListenerを設定しています。フォーカスを失うと、メソッドが呼び出され、データベース内のEditTextの値がチェックされます。メソッドの戻り値がtrueの場合、トーストが表示され、フォーカスはEditTextに再び戻るはずです。メソッドの戻り値がfalseになるまで、フォーカスは常にEditTextに戻り、キーボードが表示されます。 編集:私の本当の問題はまだ完全に明らかにしていないと思います:EditTextの値が値に編集されるまで、画面上の他のアイテムは編集できません。これにより、メソッド "checkLiganame(liganame) "falseを返します。EditText-Fieldのみを編集可能にする必要があります。 これが私のコードです(私にとってはうまくいきません): final EditText Liganame = (EditText) findViewById(R.id.liganame); Liganame.setOnFocusChangeListener(new OnFocusChangeListener() { @Override public void onFocusChange(View v, boolean hasFocus) { if (!hasFocus) { String liganame = Liganame.getText().toString(); if (checkLiganame(liganame)) { Toast toast = Toast.makeText(CreateTableActivity.this, "Dieser Liganame ist bereits vergeben", Toast.LENGTH_SHORT); toast.show(); Liganame.requestFocus(); } } そして方法: public boolean checkLiganame(String …

8
Android Java; ローカルJSONファイルをアセットフォルダーからListViewに解析するにはどうすればよいですか?
私は現在、数式のリストを表示し、それらのいくつかを解決することになっている物理アプリを開発しています(唯一の問題はListView) これが私のメインレイアウトです <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="fill_parent" android:layout_height="wrap_content" android:measureWithLargestChild="false" android:orientation="vertical" tools:context=".CatList" > <RelativeLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:background="@drawable/titlebar" > <TextView android:id="@+id/Title1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerHorizontal="true" android:layout_centerVertical="true" android:text="@string/app_name" android:textAppearance="?android:attr/textAppearanceLarge" android:textColor="#ff1c00" android:textIsSelectable="false" /> </RelativeLayout> <ListView android:id="@+id/listFormulas" android:layout_width="match_parent" android:layout_height="wrap_content" > </ListView> </LinearLayout> そして、これが私の主な活動です package com.wildsushii.quickphysics; import java.io.IOException; import java.io.InputStream; import java.util.ArrayList; import java.util.HashMap; import org.json.JSONException; import org.json.JSONObject; …


15
ネストされたリサイクラービューの高さはコンテンツをラップしません
書籍のコレクション(プレイリストなど)を管理するアプリケーションがあります。 垂直方向のRecyclerViewでコレクションのリストを表示し、各行の内側に水平方向のRecyclerViewの本のリストを表示したいと思います。 内側の水平方向のRecyclerViewのlayout_heightを300dpに設定すると、正しく表示されますが、wrap_contentに設定すると、何も表示されません。 垂直表示と水平表示を切り替えるためにレイアウトマネージャーをプログラムで変更できるようにしたいので、wrap_contentを使用する必要があります。 私が間違っていることを知っていますか? 私のフラグメントのレイアウト: <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@color/white"> <com.twibit.ui.view.CustomSwipeToRefreshLayout android:id="@+id/swipe_container" android:layout_width="match_parent" android:layout_height="match_parent"> <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> <android.support.v7.widget.RecyclerView android:id="@+id/shelf_collection_listview" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingTop="10dp"/> </LinearLayout> </com.twibit.ui.view.CustomSwipeToRefreshLayout> </LinearLayout> コレクション要素のレイアウト: <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical"> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="wrap_content" android:background="#FFF"> <!-- Simple Header --> </RelativeLayout> <FrameLayout android:layout_width="match_parent" android:layout_height="wrap_content"> <TextView android:layout_width="match_parent" android:layout_height="match_parent" android:text="@string/empty_collection" …

18
プラグインが古すぎます。最新バージョンに更新するか、ANDROID_DAILY_OVERRIDE環境変数を設定してください
今日、私はプロジェクト(アナリティクス)のモジュールとしてAndroid SDKからサンプルアプリをインポートしましたが、同期しようとすると突然、このGradleエラーが発生しました。 Plugin is too old, please update to a more recent version, or set ANDROID_DAILY_OVERRIDE envrinment variable to... これは私のアプリgradleファイルです: apply plugin: 'com.android.application' android { compileSdkVersion 22 buildToolsVersion "22.0.0" defaultConfig { applicationId "xxx.xxxxxx.xxxxx" versionCode 1 versionName '1' minSdkVersion 9 targetSdkVersion 22 versionCode 1 versionName '1' } buildTypes { release { …

24
getActionBar()はnullを返します
奇妙な問題が発生しています。私はtargetsdk 13でアプリを作っています。 メインアクティビティのonCreateメソッドでgetActionBar()、アクションバーを設定するために呼び出します。これは、Android 3.2エミュレータで実行すると問題なく機能しますが、Android 3.0および3.1を使用するとgetActionBar()メソッドはnullを返します。 私はこれを非常に奇妙に思います、そしてそれがそうする理由を私は見ることができません。これはエミュレータのバグですか、それともアプリケーションにアクションバーがあることを確認するために何かする必要がありますか? SOLUTION: 私はこの問題の解決策を見つけたと思います。アクティビティのレイアウトを設定するためにsetContentViewを使用していませんでした。代わりにfragmentTransaction.add(android.R.id.content, mFragment, mTag)、アクティビティにフラグメントを追加するために使用していました。これは3.2では問題なく機能しましたが、以前のハニカムバージョンでは、onCreate()メソッドでsetContentViewを使用しない場合、アクションバーは設定されないようです。したがって、setContentView()メソッドでメソッドを使用しonCreate()、空のFrameLayoutを含むレイアウトを提供するだけで修正しました。私はまだ使用できますfragmentTransaction.add(android.R.id.content, mFragment, mTag)方法は以前と同じようにます。 それは最もきれいな修正ではありませんが、動作します。

4
CoordinatorLayoutのツールバーの下にビューを追加する
次のレイアウトがあります。 <android.support.design.widget.CoordinatorLayout android:id="@+id/main_content" xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="match_parent"> <android.support.design.widget.AppBarLayout android:id="@+id/appBar" android:layout_width="match_parent" android:layout_height="wrap_content" android:theme="@style/ThemeOverlay.AppCompat.ActionBar"> <android.support.v7.widget.Toolbar android:id="@+id/toolbar" android:layout_width="match_parent" android:layout_height="?attr/actionBarSize" android:background="?attr/colorPrimary" app:layout_scrollFlags="scroll|enterAlways" app:popupTheme="@style/ThemeOverlay.AppCompat.Light"/> </android.support.design.widget.AppBarLayout> <FrameLayout android:id="@+id/content" android:layout_width="match_parent" android:layout_height="match_parent" /> </android.support.design.widget.CoordinatorLayout> にを追加FragmentしてFrameLayout置き換えます。私Fragmentのの1つは次のレイアウトのリストです。 <android.support.v7.widget.RecyclerView xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:id="@+id/recyclerView" android:layout_width="match_parent" android:layout_height="match_parent" app:layout_behavior="@string/appbar_scrolling_view_behavior"/> ここで、ツールバーがリストの上に描画されるという私の問題。私はのコンテンツをにラップすることで解決しようとしCoordinatorLayoutましたがLinearLayout、オーバードローは解決されましたが、その方法ではアプリバーのスクロール動作が機能しなくなりました。 どんな助けでも大歓迎です!

6
文字列をURIに変換
Java(Android)で文字列をUriに変換するにはどうすればよいですか?つまり: String myUrl = "http://stackoverflow.com"; myUri = ???;
176 java  android  string  uri 

13
フラグメントとそのコンテナアクティビティの間でデータを受け渡す
フラグメントとそのコンテナアクティビティの間でデータを渡すにはどうすればよいですか?インテントを介してアクティビティ間でデータを渡すことに似たものはありますか? 私はこれを読みましたが、あまり役に立ちませんでした:http : //developer.android.com/guide/topics/fundamentals/fragments.html#CommunicatingWithActivity

12
onStart()とonResume()の違い
onStart()遷移状態の意味がわかりません。onResume()この方法は、常に後に呼び出されますonStart()。なぜonResume()呼び出されonRestart()、onCreate()メソッドが除外されonStart()ないのですか?その目的は何ですか? なしでは生きられないのはなぜですかonStart()。私はまだそれを冗長だと考えています(おそらくその意味を完全に理解していないためです)。
176 android 



弊社のサイトを使用することにより、あなたは弊社のクッキーポリシーおよびプライバシーポリシーを読み、理解したものとみなされます。
Licensed under cc by-sa 3.0 with attribution required.