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

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

4
KMLファイルを使用して地図上にパスを描画する方法
Androidでパスまたはポイントを表示するためにKMLファイルを解析できますか?それを手伝ってくれませんか? これは、android google mapに表示したいkmlサンプルコードです。 <?xml version="1.0" encoding="UTF-8"?> <kml xmlns="http://www.opengis.net/kml/2.2"> <Document> <name>Paths</name> <description>Examples of paths. Note that the tessellate tag is by default set to 0. If you want to create tessellated lines, they must be authored (or edited) directly in KML.</description> <Style id="yellowLineGreenPoly"> <LineStyle> <color>7f00ffff</color> <width>4</width> </LineStyle> <PolyStyle> <color>7f00ff00</color> </PolyStyle> …

16
ユーザーがフォーカスする前に、TextInputLayoutにEditTextヒントが表示されない
EditTextsでフローティングラベルを表示するために、最近リリースされたAndroid Design Support Libraryを使用しています。しかし、UIがレンダリングされたときにEditTextのヒントが表示されないという問題に直面していますが、EditTextにフォーカスするとヒントが表示されます。 私のレイアウトは次のとおりです: <?xml version="1.0" encoding="utf-8"?> <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent"> <FrameLayout android:layout_width="match_parent" android:layout_height="match_parent"> <ScrollView android:id="@+id/ScrollView01" android:layout_width="match_parent" android:layout_height="match_parent" android:scrollbars="vertical"> <LinearLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="vertical" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin"> <android.support.design.widget.TextInputLayout android:id="@+id/name_et_textinputlayout" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginTop="@dimen/activity_vertical_margin"> <EditText android:id="@+id/FeedBackerNameET" android:layout_width="fill_parent" android:layout_height="wrap_content" android:hint="@string/feedbackname" android:inputType="textPersonName|textCapWords" /> </android.support.design.widget.TextInputLayout> <android.support.design.widget.TextInputLayout android:id="@+id/email_textinputlayout" android:layout_width="match_parent" android:layout_height="wrap_content"> <EditText android:id="@+id/FeedBackerEmailET" android:layout_width="fill_parent" android:layout_height="wrap_content" android:hint="@string/feedbackemail" android:inputType="textEmailAddress" /> …

12
Android Studioでエミュレーターを実行できない
Android Studioのインストールを完了し、それをテスト実行に使用しようとしました。アプリを実行しようとすると、次のエラーメッセージが表示されます emulator: ERROR: This AVD's configuration is missing a kernel file!! emulator: ERROR: ANDROID_SDK_ROOT is undefined 誰かがこれを修正する方法を知っていますか????

20
CameraUpdateFactory.newLatLngBoundsを含むmoveCameraがクラッシュする
新しいAndroid Google Maps APIを利用しています。 MapFragmentを含むアクティビティを作成します。アクティビティonResumeでは、マーカーをGoogleMapオブジェクトに設定し、すべてのマーカーを含む地図の境界ボックスを定義します。 これは次の疑似コードを使用しています: LatLngBounds.Builder builder = new LatLngBounds.Builder(); while(data) { LatLng latlng = getPosition(); builder.include(latlng); } CameraUpdate cameraUpdate = CameraUpdateFactory .newLatLngBounds(builder.build(), 10); map.moveCamera(cameraUpdate); を呼び出すmap.moveCamera()と、次のスタックでアプリケーションがクラッシュします。 Caused by: java.lang.IllegalStateException: Map size should not be 0. Most likely, layout has not yet at maps.am.r.b(Unknown Source) at maps.y.q.a(Unknown Source) at maps.y.au.a(Unknown …

7
Android Studioユニットテスト:データ(入力)ファイルの読み取り
単体テストで、パスをハードコーディングせずに、(デスクトップ)ファイルシステムのjsonファイルからデータを読み取るにはどうすればよいですか? 静的文字列を作成するのではなく、ファイルからテスト入力(解析メソッド用)を読み取りたいのですが。 ファイルはユニットテストコードと同じ場所にありますが、必要に応じてプロジェクト内の別の場所に配置することもできます。Android Studioを使用しています。

12
Androidアプリでボタンをクリックして2番目のアクティビティを開く方法
私はAndroidアプリケーションの構築を学んでおり、具体的な支援が必要です。テンプレートコードのどのビットを変更する必要があるのか​​、どのビットが静的であるのか、頭を悩ませているようです。 ではレイアウト私は私の持っているフォルダACTIVITY_MAIN.XML読み込み <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="horizontal"> <Button android:id="@+id/button1" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="@string/main_buttons_photos" /> </LinearLayout> 次に、2つ目のアクティビティACTIVITY_SEND_PHOTOS.XMLがあります。 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" > <TextView android:id="@+id/textView2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerHorizontal="true" android:layout_centerVertical="true" android:text="@string/hello_world" tools:context=".SendPhotos" /> <TextView android:id="@+id/textView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:layout_alignParentTop="true" android:text="@string/title_activity_send_photos" android:textAppearance="?android:attr/textAppearanceLarge" /> </RelativeLayout> 次にMainActivity.java(これは.classですか?)を持っています。これはパッケージcom.example.assent.bcを読み取ります。 import android.os.Bundle; import android.app.Activity; import …


1
Android SQLite:挿入/置換メソッドのnullColumnHackパラメーター
Android SDKには、SQLiteでデータを操作するための便利なメソッドがいくつかあります。ただし、挿入メソッドと置換メソッドの両方で、nullColumnHack使用法がわからないパラメーターを使用しています。 ドキュメントはそれを次のように説明していますが、テーブルに複数の列を許可するとNULLどうなりますか?本当にわかりません:/ SQLでは完全に空の行を挿入できないため、initialValuesが空の場合、この列[ / row for replace ]には明示的にNULL値が割り当てられます。
96 android  sqlite 

10
フラグメントから現在のアクティビティを終了する
ナビゲーションドロワーとして使用しているアクティビティにフラグメントがあります。これには、クリックすると新しいアクティビティを開始するボタンが含まれます(フラグメントのstartActivityは、現在のアクティビティのstartActivityを呼び出すだけです)。 私の人生では、新しいアクティビティを開始した後、現在のアクティビティをどのように終了するのかわからないようです。 私はフラグメントでこのようなことを達成しようとしています: @Override public void onClick(View view) { // TODO Auto-generated method stub if (view == mButtonShows) { Intent intent = new Intent(view.getContext(), MyNewActivity.class); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivity(intent); finish(); } } しかし、Fragment.classはfinish()を実装していないようです(startActivity(...)を実装しているように)。 2番目のアクティビティを起動したときに、アクティビティのバックスタックをクリアしてください。(したがって、新しいアクティビティから戻ると、技術的にはランチャーに戻されます)
96 android 

13
通常、どのようにログエントリにタグを付けますか?(アンドロイド)
ほとんどの人がandroid.util.Logを知っていると思います。すべてのロギングメソッドは、最初の引数として「文字列タグ」を受け入れます。 そして、私の質問は、通常、アプリケーションでログにどのようにタグを付けるのですか? 次のようなハードコードを見たことがあります。 public class MyActivity extends Activity { private static final String TAG = "MyActivity"; //... public void method () { //... Log.d(TAG, "Some logging"); } } これは多くの理由により見栄えがよくありません: このコードにはハードコードがありませんが、あります。 私のアプリケーションでは、同じ名前の異なるパッケージに任意の数のクラスを含めることができます。したがって、ログを読み取るのは難しいでしょう。 柔軟ではありません。あなたは常にプライベートフィールドTAGをクラスに入れました。 クラスのタグを取得するためのきちんとした方法はありますか?
96 android  logging 

12
オプションメニューの背景色を変更する方法
オプションメニューのデフォルトの色を白に変更しようとしています。オプションメニューのすべての項目の背景を黒にします。 menu要素内のitem要素でandroid:itemBackground = "#000000"のようないくつかの撮影を試みましたが、機能しませんでした。 どうすればこれを達成できますか?

5
IntentとPendingIntentの違い
私はいくつかの記事を読みましたが、どちらも同じことをしているようで、そのようにサービスを開始することの違いは何だろうと思っていました。 Intent intent = new Intent(this, HelloService.class); startService(intent); またはそのように: Calendar cal = Calendar.getInstance(); Intent intent = new Intent(this, MyService.class); PendingIntent pintent = PendingIntent.getService(this, 0, intent, 0); AlarmManager alarm = (AlarmManager)getSystemService(Context.ALARM_SERVICE); alarm.setRepeating(AlarmManager.RTC_WAKEUP, cal.getTimeInMillis(), 30*1000, pintent); 読んだとおり、サービスでパラメーターSTART_STICKYを返す場合、これら2つは同じことを行います。

7
Android SQLite DBを閉じるタイミング
AndroidでSQLiteデータベースを使用しています。データベースマネージャーはシングルトンで、初期化時にデータベースへの接続を開いています。誰かが私のクラスを呼び出してデータベースを操作するときにすでに開いているように、データベースをずっと開いたままにしても安全です。または、各アクセスが必要になる前後にデータベースを開いて閉じる必要があります。ずっと開いたままにしておくことに害はありますか? ありがとう!
96 android  sqlite 

11
Nested Scrollviewスクロール内のRecyclerviewですが、通常のRecyclerviewまたはNested Scrollviewのように高速スクロールしません。
私はRecyclerView内部NestedScrollViewを使用していますが、動作します。でもRecyclerView中LinearLayoutなどで使うと、ジェスチャーによって様々なスピードでスクロールしてしまいます。スクロールはジェスチャーを聞き、少しだけ上にスライドすると少しスクロールしますが、上に非常に速くスライドすると非常に速くスクロールします。今私の問題は、RecyclerView内部がNestedScrollView確かにスクロールするが、高速スクロールが機能しないことです。しかし、私は速いか遅い上にスライド、RecyclerViewまたはNestedScrollView少しだけスクロールします。 スクロールビューNestedScrollViewまたはRecyclerViewその内部をさまざまな速度でスクロールさせるにはどうすればよいですか?

25
ステータスバーが白くなり、その背後にあるコンテンツが表示されない
私はマシュマロでAppCompatを試しています。透明なステータスバーが必要ですが、白くなります。私はいくつかの解決策を試しましたが、うまくいきませんでした(透明なステータスバーがwindowTranslucentNavigation = "false"で機能しない、Lollipop:statusBarの後ろに色を透明に設定して描画します)。ここに関連するコードがあります。 私のstyles.xml <style name="Bacon" parent="Theme.Bacon"/> <style name="Theme.Bacon" parent="Theme.AppCompat.Light.NoActionBar"> <item name="colorPrimary">@color/theme_primary</item> <item name="colorPrimaryDark">@color/theme_primary_dark</item> <item name="colorAccent">@color/theme_accent</item> <item name="windowActionBar">false</item> <item name="windowActionBarOverlay">true</item> <item name="windowNoTitle">true</item> <item name="android:windowBackground">@color/background_material_light</item> </style> <style name="Theme.Bacon.Detail" parent="Bacon"/> v21 <style name="Bacon" parent="Theme.Bacon"> <item name="android:windowDrawsSystemBarBackgrounds">true</item> </style> <style name="Theme.Bacon.Detail" parent="Bacon"> <item name="android:statusBarColor">@android:color/transparent</item> </style> アクティビティ <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:fitsSystemWindows="true"> <android.support.v4.view.ViewPager android:id="@+id/pager" android:layout_width="match_parent" …

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