본문 바로가기

분류 전체보기288

Keeping your app Awake in android written by https://developer.android.com/training/scheduling/wakelock.html Keeping the Device Awake이전다음This lesson teaches you toKeep the Screen OnKeep the CPU OnTry it outDOWNLOAD THE SAMPLEScheduler.zipTo avoid draining the battery, an Android device that is left idle quickly falls asleep. However, there are times when an application needs to wake up the screen or the CPU and keep it awake to .. 2017. 7. 16.
each toolbar different navigation drawer written by https://stackoverflow.com/questions/35015182/different-toolbar-for-fragments-and-navigation-drawer Different toolbar for fragments and Navigation DrawerAsk Questionup vote7down votefavorite3Please, explain to me... I have Navigation Drawer in my Activity and it syncs with Toolbar(like ActionBar). Activity has few fragments and in different fragments I need to use different AppBar mode.. 2017. 7. 15.
when using imageView in camera written by https://stackoverflow.com/questions/34504717/android-app-crashes-on-onactivityresult-while-using-camera-intent/34626655 Follow below steps in order to take picture from camera and display onto ImageView1) Start Camera IntentUri fileUri; String photoPath = ""; private void startingCameraIntent() { String fileName = System.currentTimeMillis()+".jpg"; ContentValues values = new ContentVa.. 2017. 7. 8.
how to deal activity value interaction down voteIf you want to pass data from the preference activity to your main activity use this code:In your main activity class (launch):startActivityForResult(new Intent(main.this, preferences.class), 0);In your preference activity class (set the result):Intent i; i.putStringExtra("name", "tom"); setResult(RESULT_OK, i); finish();In your main activity class (get the result):@Override protected v.. 2017. 7. 8.
how to use option menu icon each Toolbar in Fragment written by http://gwpark.tistory.com/1993 [ \res\menu\menu_one.xml ] [ \res\menu\menu_two.xml ] [ FragmentOne.java ]public class FragmentOne extends Fragment { @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { super.onCreate(savedInstanceState); // if this is set true, // Activity.onCreateOptionsMenu will call Fragment.onCreateOptionsMe.. 2017. 7. 1.
how to stop a back button in android @Override public void onBackPressed() { //thats it }OR @Override public boolean onKeyDown(int keyCode, KeyEvent event) { return (keyCode == KeyEvent.KEYCODE_BACK ? true : super.onKeyDown(keyCode, event)); } 2017. 4. 14.
how to make a swiped multi tabed view in android written by http://stackoverflow.com/questions/35594612/how-to-load-the-fragments-when-the-tab-is-selected-or-page-is-swiped when I am swiping tabs are changing but fragment that I attached is not loading. I have created 4 fragments and their layouts I have included pagerAdapter in the mainActivity class output(showing blank page when tab is selected) Here is my MainActivity.javapublic class Main.. 2017. 4. 14.
how to use listview with onItemClick Event how to use listview public class MainActivity extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); ListView listView1 = (ListView) findViewById(R.id.listView1); Product[] items = { new Product(1, "Milk", 21.50), new Product(2, "Butter", 15.99), new Product(3, "Yogurt", 14.90), new Product(4, "Toothpaste".. 2016. 11. 13.
to avoid overlap a previous menu view @Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); getView().setBackgroundColor(Color.WHITE); getView().setClickable(true); } 0down voteWell Setting up fragment background color is not a solution because fragment will be still in the activity stack which may consume memory.Solution would be remove all views from your framelayout befo.. 2016. 11. 12.