Click here to Skip to main content
15,912,400 members
Home / Discussions / Android
   

Android

 
GeneralRe: Implement a web server based on REST Protocol in android Pin
eb.shirani18-Apr-14 22:25
eb.shirani18-Apr-14 22:25 
GeneralRe: Implement a web server based on REST Protocol in android Pin
Richard MacCutchan18-Apr-14 22:33
mveRichard MacCutchan18-Apr-14 22:33 
AnswerRe: Implement a web server based on REST Protocol in android Pin
Sudheendra8721-Apr-14 19:56
Sudheendra8721-Apr-14 19:56 
Questioncomo fazer um cliente servidor? Pin
willian baroni6-May-14 10:18
willian baroni6-May-14 10:18 
QuestionHow to pass database record one activity to another activity Pin
Rafique Android Developer17-Apr-14 4:59
Rafique Android Developer17-Apr-14 4:59 
AnswerRe: How to pass database record one activity to another activity Pin
Yuvraaz Poudel17-Apr-14 20:14
Yuvraaz Poudel17-Apr-14 20:14 
Questionhow to view data from mysql use php and these data show in android app in listview Pin
Rafique Android Developer17-Apr-14 4:50
Rafique Android Developer17-Apr-14 4:50 
Questionmy navigation drawer doesnot work in android version less than 4.1. Pin
Yuvraaz Poudel16-Apr-14 20:44
Yuvraaz Poudel16-Apr-14 20:44 
public class SwappingClassDashboard extends Activity {
DrawerLayout dl;
ListView list;
ActionBarDrawerToggle toogle;

CharSequence title, dtitle;

String[] acfservice;
MainActivity mainactivity;

@Override
protected void onCreate(Bundle savedInstanceState) {

ActionBar actionbar = getActionBar();
ColorDrawable colorDrawable = new ColorDrawable(
Color.parseColor("#0067b4"));
actionbar.setBackgroundDrawable(colorDrawable);
super.onCreate(savedInstanceState);
setContentView(R.layout.swapping_layout);

// initializing the value for username and passord field for login
mainactivity = new MainActivity();

// end of variable assignment
title = dtitle = getTitle();
acfservice = getResources().getStringArray(R.array.acf_array);
dl = (DrawerLayout) findViewById(R.id.drawer_layout);
list = (ListView) findViewById(R.id.listview);

// set a custom shadow that overlays the main content when the drawer
// opens
dl.setDrawerShadow(R.drawable.drawer_shadow, Gravity.START);
// set up the drawer's list view with items and click listener
list.setAdapter(new ArrayAdapter<string>(this, R.layout.list_drawer,
acfservice));
list.setOnItemClickListener(new DrawerItemClickListener());

// enable ActionBar app icon to behave as action to toggle nav drawer
ActionBar actionbar1 = getActionBar();
actionbar1.setIcon(R.drawable.acf);
actionbar1.setTitle("ACFNepal");
actionbar1.setDisplayOptions(ActionBar.DISPLAY_SHOW_TITLE
| ActionBar.DISPLAY_SHOW_HOME | ActionBar.DISPLAY_HOME_AS_UP);

// ActionBarDrawerToggle ties together the the proper interactions
// between the sliding drawer and the action bar app icon
toogle = new ActionBarDrawerToggle(this, /* host Activity */
dl, /* DrawerLayout object */
R.drawable.click, /* nav drawer image to replace 'Up' caret */
R.string.onopen, /* "open drawer" description for accessibility */
R.string.onclose /* "close drawer" description for accessibility */
) {

public void onDrawerClosed(View view) {
getActionBar().setTitle(title);
invalidateOptionsMenu(); // creates call to
// onPrepareOptionsMenu()
}

public void onDrawerOpened(View drawerView) {
getActionBar().setTitle(dtitle);
invalidateOptionsMenu(); // creates call to
// onPrepareOptionsMenu()
}

};
dl.setDrawerListener(toogle);

if (savedInstanceState == null) {
selectItem(0);
}
}

@Override
public boolean onCreateOptionsMenu(Menu menu) {
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.mainmenu, menu);
return super.onCreateOptionsMenu(menu);
}

/* Called whenever we call invalidateOptionsMenu() */
@Override
public boolean onPrepareOptionsMenu(Menu menu) {
// If the nav drawer is open, hide action items related to the content
// view
boolean drawerOpen = dl.isDrawerOpen(list);
menu.findItem(R.id.user).setVisible(!drawerOpen);
// menu.findItem(R.id.setting).setVisible(!drawerOpen);
// menu.findItem(R.id.back).setVisible(!drawerOpen);

return super.onPrepareOptionsMenu(menu);
}

@Override
public boolean onOptionsItemSelected(MenuItem item) {

if (toogle.onOptionsItemSelected(item)) {
return true;
}
// Handle action buttons
switch (item.getItemId()) {

case R.id.sign_out: {
startActivity(new Intent(SwappingClassDashboard.this,
MainActivity.class));

android.os.Process.killProcess(android.os.Process.myPid());

}
break;
case R.id.exit: {
final Dialog d1 = new Dialog(this);
d1.requestWindowFeature(Window.FEATURE_LEFT_ICON);
d1.setTitle("Do you want to exit Application ?");

d1.setContentView(R.layout.dial_exit);
d1.setCancelable(true);
d1.show();

Button btnyes, btnno;
btnyes = (Button) d1.findViewById(R.id.exityes);
btnno = (Button) d1.findViewById(R.id.exitno);
btnyes.setOnClickListener(new View.OnClickListener() {

@Override
public void onClick(View arg0) {
// Intent intent=getIntent();
Intent intent = new Intent(Intent.ACTION_MAIN);
intent.addCategory(Intent.CATEGORY_HOME);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);

startActivity(intent);

intent.setClass(getApplicationContext(),
StartACFActivity.class);
startActivity(intent);
d1.dismiss();

finish();
android.os.Process.killProcess(android.os.Process.myPid());

}
});
btnno.setOnClickListener(new View.OnClickListener() {

@Override
public void onClick(View arg0) {

d1.dismiss();

}
});

}
break;

default:
return super.onOptionsItemSelected(item);
}
return false;

}

/* The click listner for ListView in the navigation drawer */
private class DrawerItemClickListener implements
ListView.OnItemClickListener {
@Override
public void onItemClick(AdapterView parent, View view, int position,
long id) {
selectItem(position);
}
}

private void selectItem(int position) {
// update the main content by replacing fragments
Fragment fragment = null;
switch (position) {
case 0:
fragment = new Dashboard();
break;
// case 1:
// fragment = new SystemUsers();
// break;

case 1:
startActivity(new Intent(SwappingClassDashboard.this,
AssessmentCard.class));
break;

// case 3:
// startActivity(new Intent(SwappingClassDashboard.this,
// DisplayChildList.class));
// break;

case 2:
startActivity(new Intent(SwappingClassDashboard.this,
SyncDatabase.class));

break;
default:
break;
}
if (fragment != null) {
FragmentManager fragmentManager = getFragmentManager();
fragmentManager.beginTransaction()
.replace(R.id.content_frame, fragment).commit();

// update selected item and title, then close the drawer
list.setItemChecked(position, true);
setTitle(acfservice[position]);
dl.closeDrawer(list);
} else {
// error in creating fragment
Log.e("SwappingClassDashboard", "error in creation fragment");
}
}

@Override
public void onBackPressed() {
Intent nextActivity = new Intent(this, MainActivity.class);
startActivity(nextActivity);
}

@Override
public void setTitle(CharSequence t) {
title = t;
getActionBar().setTitle(title);
}

@Override
protected void onPostCreate(Bundle savedInstanceState) {
super.onPostCreate(savedInstanceState);
// Sync the toggle state after onRestoreInstanceState has occurred.
toogle.syncState();
}

@Override
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
// Pass any configuration change to the drawer toggls
toogle.onConfigurationChanged(newConfig);
}
}
Questiontext Pin
Member 107342698-Apr-14 9:54
Member 107342698-Apr-14 9:54 
AnswerRe: text Pin
Richard MacCutchan8-Apr-14 9:56
mveRichard MacCutchan8-Apr-14 9:56 
AnswerRe: text Pin
Member 1069480010-May-14 10:08
Member 1069480010-May-14 10:08 
QuestionMainActivity or MainFragment? Pin
Jassim Rahma4-Apr-14 3:15
Jassim Rahma4-Apr-14 3:15 
QuestionClass requires API level 11 (current min is 8) Pin
Jassim Rahma4-Apr-14 2:09
Jassim Rahma4-Apr-14 2:09 
AnswerRe: Class requires API level 11 (current min is 8) Pin
Peter Leow4-Apr-14 2:29
professionalPeter Leow4-Apr-14 2:29 
AnswerRe: Class requires API level 11 (current min is 8) Pin
Rafique Android Developer17-Apr-14 5:04
Rafique Android Developer17-Apr-14 5:04 
Questionproblem with android html5 app Pin
Jassim Rahma30-Mar-14 0:20
Jassim Rahma30-Mar-14 0:20 
AnswerRe: problem with android html5 app Pin
Kornfeld Eliyahu Peter30-Mar-14 3:37
professionalKornfeld Eliyahu Peter30-Mar-14 3:37 
GeneralRe: problem with android html5 app Pin
Jassim Rahma30-Mar-14 7:56
Jassim Rahma30-Mar-14 7:56 
AnswerRe: problem with android html5 app Pin
Kornfeld Eliyahu Peter30-Mar-14 7:59
professionalKornfeld Eliyahu Peter30-Mar-14 7:59 
NewsBitmap from view with opaque/semi transparent background Pin
DaveyM6926-Mar-14 12:25
professionalDaveyM6926-Mar-14 12:25 
GeneralRe: Bitmap from view with opaque/semi transparent background Pin
hhsumon31-Mar-14 2:00
hhsumon31-Mar-14 2:00 
GeneralRe: Bitmap from view with opaque/semi transparent background Pin
DaveyM692-Apr-14 9:36
professionalDaveyM692-Apr-14 9:36 
Questiondetection de personne dans une image Pin
ranouna24-Mar-14 6:12
ranouna24-Mar-14 6:12 
SuggestionRe: detection de personne dans une image Pin
Richard Deeming24-Mar-14 10:06
mveRichard Deeming24-Mar-14 10:06 
Generalcount the number of people in the image Pin
ranouna25-Apr-14 0:58
ranouna25-Apr-14 0:58 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.