[android-developers] Digest for android-developers@googlegroups.com - 7 updates in 7 topics

Jason Flanagan <spellj24@gmail.com>: Jun 11 06:54PM -0700

This,
http://stackoverflow.com/questions/2661536/how-to-programmatically-take-a-screenshot-in-android,
seems to be a good place to start.
 
-JF
 
On Thursday, June 9, 2016 at 8:53:10 AM UTC-4, Gulwant gill wrote:
Hamid <hamidsafdari22@gmail.com>: Jun 11 06:47PM -0700

When I click on a menu item in my Android app, I get this nested box inside
the highlighted item:
 
<https://lh3.googleusercontent.com/-C7-4qvBTKyY/V1y-cKEajjI/AAAAAAAAAhU/5owmwapolDYp7wxT8GYGKbDISA3SGtz_QCLcB/s1600/XX4gC.png>
 
 
I have this in my styles.xml
 
<style name="AppTheme.PopupOverlay"
parent="ThemeOverlay.AppCompat.Dark">
<item name="android:textColor">@color/textColorPrimaryLight</item>
<item name="android:textColorPrimary">@color/textColorPrimaryLight</item>
<item name="android:textColorSecondary">@color/textColorSecondaryLight</item>
<item name="colorAccent">@color/colorAccent</item></style>
 
and this in colors.xml
 
<color name="colorPrimary">#F39300</color><color name="colorPrimaryDark">#FDAE09</color><color name="colorStatusBar">#e3f39300</color><color name="colorAccent">#FF4081</color><color name="colorError">#d50000</color><color name="colorEmergency">#ff8a80</color>
 
and I am using this for the ActionBar
 
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:animateLayoutChanges="true"
app:popupTheme="@style/AppTheme.PopupOverlay"
app:title="@string/app_name"
tools:ignore="UnusedAttribute" />
 
Any ideas on how to remove this item so when I click on the menu item, it
is highlighted like a button does?
ronaldo.nazario2016@zipmail.com.br: Jun 11 12:03PM -0700

I'm new to Android, and i've got some issues. It looks like it's saying
that's having an null object passed to it, but I'm not sure. Where I missed
a step? Any help is appreciated.
 
*Logcat:*
 
<!-- language: lang-java -->
 
 
06-11 14:58:37.786 7537-7537/com.androidtutorialpoint.employeemanagementsystem E/AndroidRuntime: FATAL EXCEPTION: main
Process <http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+process>: com.androidtutorialpoint.employeemanagementsystem, PID: 7537
java.lang.NullPointerException <http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+nullpointerexception>: Attempt to invoke virtual method 'android.database.Cursor android.database.sqlite.SQLiteDatabase.query(java.lang.String, java.lang.String[], java.lang.String, java.lang.String[], java.lang.String, java.lang.String, java.lang.String, java.lang.String)' on a null object reference
at com.androidtutorialpoint.employeemanagementsystem.DB.EmployeeOperations.getEmployee(EmployeeOperations.java:63)
at com.androidtutorialpoint.employeemanagementsystem.MainActivity$6.onClick(MainActivity.java:135)
at android.support.v7.app.AlertController$ButtonHandler.handleMessage(AlertController.java:157)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5294)
at java.lang.reflect.Method <http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+method>.invoke(Native Method <http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+method>)
at java.lang.reflect.Method <http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+method>.invoke(Method <http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+method>.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:904)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:699)
1.

<!-- language: lang-none -->

2.

*EmployeeOperations:*

3.

<!-- language: lang-java -->,

4.

// Getting single Employee
public Employee getEmployee(long id) {

Cursor <http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+cursor> cursor = database.query(EmployeeDBHandler.TABLE_EMPLOYEES,allColumns,EmployeeDBHandler.COLUMN_ID + "=?",new String <http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+string>[]{String <http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+string>.valueOf(id)},null,null, null, null);
if (cursor != null)
cursor.moveToFirst();

Employee e = new Employee(Long <http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+long>.parseLong(cursor.getString(0)),cursor.getString(1),cursor.getString(2),cursor.getString(3),cursor.getString(4),cursor.getString(5));
// return Employee
return e;
}
1.

5.


* MainActivity:*

6.


 
 
*1. public class MainActivity extends AppCompatActivity{2. 3. private Button <http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+button> addEmployeeButton;4. private Button <http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+button> editEmployeeButton;5. private Button <http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+button> deleteEmployeeButton;6. private Button <http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+button> viewAllEmployeeButton;7. private EmployeeOperations employeeOps;8. private static final String <http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+string> EXTRA_EMP_ID = "com.androidtutorialpoint.empId";9. private static final String <http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+string> EXTRA_ADD_UPDATE = "com.androidtutorialpoint.add_update";10. @Override11. protected void onCreate(Bundle savedInstanceState) {12. employeeOps = new EmployeeOperations(MainActivity.this);13. super.onCreate(savedInstanceState);14. 15. setContentView(R.layout.activity_main);16. addEmployeeButton = (Button <http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+button>) findViewById(R.id.button_add_employee);17. editEmployeeButton = (Button <http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+button>) findViewById(R.id.button_edit_employee);18. deleteEmployeeButton = (Button <http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+button>) findViewById(R.id.button_delete_employee);19. viewAllEmployeeButton = (Button <http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+button>)findViewById(R.id.button_view_employees);20. 21. 22. 23. addEmployeeButton.setOnClickListener(new View <http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+view>.OnClickListener() {24. @Override25. public void onClick(View <http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+view> v) {26. Intent i = new Intent(MainActivity.this,AddUpdateEmployee.class);27. i.putExtra(EXTRA_ADD_UPDATE, "Add");28. startActivity(i);29. }30. });31. editEmployeeButton.setOnClickListener(new View <http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+view>.OnClickListener() {32. @Override33. public void onClick(View <http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+view> v) {34. getEmpIdAndUpdateEmp();35. }36. });37. deleteEmployeeButton.setOnClickListener(new View <http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+view>.OnClickListener() {38. @Override39. public void onClick(View <http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+view> v) {40. getEmpIdAndRemoveEmp();41. }42. });43. viewAllEmployeeButton.setOnClickListener(new View <http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+view>.OnClickListener() {44. @Override45. public void onClick(View <http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+view> v) {46. Intent i = new Intent(MainActivity.this, ViewAllEmployees.class);47. startActivity(i);48. }49. });50. 51. }52. 53. 54. @Override55. public boolean onCreateOptionsMenu(Menu <http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+menu> menu) {56. getMenuInflater().inflate(R.menu.employee_menu, menu);57. return true;58. }59. 60. @Override61. public boolean onOptionsItemSelected(MenuItem <http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+menuitem> item) {62. int id = item.getItemId();63. if (id == R.id.menu_item_settings) {64. return true;65. }66. return super.onOptionsItemSelected(item);67. }68. 69. 70. public void getEmpIdAndUpdateEmp(){71. 72. LayoutInflater li = LayoutInflater.from(this);73. View <http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+view> getEmpIdView = li.inflate(R.layout.dialog_get_emp_id, null);74. 75. AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(this);76. // set dialog_get_emp_id.xml to alertdialog builder77. alertDialogBuilder.setView(getEmpIdView);78. 79. final EditText userInput = (EditText) getEmpIdView.findViewById(R.id.editTextDialogUserInput);80. 81. // set dialog message82. alertDialogBuilder83. .setCancelable(false)84. .setPositiveButton("OK",new DialogInterface.OnClickListener() {85. public void onClick(DialogInterface dialog,int id) {86. // get user input and set it to result87. // edit text88. Intent i = new Intent(MainActivity.this,AddUpdateEmployee.class);89. i.putExtra(EXTRA_ADD_UPDATE, "Update");90. i.putExtra(EXTRA_EMP_ID, Long <http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+long>.parseLong(userInput.getText().toString()));91. startActivity(i);92. }93. }).create()94. .show();95. 96. }97. 98. 99. public void getEmpIdAndRemoveEmp(){100. 101. LayoutInflater li = LayoutInflater.from(this);102. View <http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+view> getEmpIdView = li.inflate(R.layout.dialog_get_emp_id, null);103. 104. AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(this);105. // set dialog_get_emp_id.xml to alertdialog builder106. alertDialogBuilder.setView(getEmpIdView);107. 108. final EditText userInput = (EditText) getEmpIdView.findViewById(R.id.editTextDialogUserInput);109. 110. // set dialog message111. alertDialogBuilder112. .setCancelable(false)113. .setPositiveButton("OK",new DialogInterface.OnClickListener() {114. public void onClick(DialogInterface dialog,int id) {115. // get user input and set it to result116. // edit text117. employeeOps = new EmployeeOperations(MainActivity.this);118. employeeOps.removeEmployee(employeeOps.getEmployee(Long <http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+long>.parseLong(userInput.getText().toString())));119. Toast t = Toast.makeText(MainActivity.this,"Employee removed successfully!",Toast.LENGTH_SHORT);120. t.show();121. }122. }).create()123. .show();124. 125. }126. 127. 128. 129. @Override130. protected void onResume() {131. super.onResume();132. employeeOps.open();133. }134. 135. @Override136. protected void onPause() {137. super.onPause();138. employeeOps.close();139. 140. }141. } *

7.
Deni Zafi <denizafi2015@gmail.com>: Jun 11 09:33AM -0700

*Top Offer On All Of Clickbank!* Affiliates are making up to $5,000 per day
promoting this offer. You'll earn 75% commission on ALL sales and they'll
even send followup emails with your affiliate ID in them to make sure you
get credit! If you've never promoted a Clickbank product before, this one
is guaranteed to get a lot of sales for you!
NEELAY SRIVASTAVA <neelay1318@gmail.com>: Jun 11 12:32AM -0700

I have tried many times and googled many times but i m not able to find a
solution to get the audio file from both internal and external storage.how
i can get this any link or example will be helpful
gjs <garyjamessilva@gmail.com>: Jun 11 12:21AM -0700

https://www.sqlite.org/docs.html
Lout <lout.rlly@gmail.com>: Jun 11 12:11AM -0700

Was fine for early days but even after 10 years of development, we
shouldn't have to stick to an early bad design choice.
Forcing to have duplicates is a recipe for future errors.
 
res/raw_string or some such could always be used instead of
res/values/string.
 
 
 
On Tuesday, September 14, 2010 at 5:24:09 AM UTC+5:30, Dan wrote:
You received this digest because you're subscribed to updates for this group. You can change your settings on the group membership page.
To unsubscribe from this group and stop receiving emails from it send an email to android-developers+unsubscribe@googlegroups.com.

No comments:

Post a Comment