daily pastebin goal
57%
SHARE
TWEET

Untitled

a guest Jul 22nd, 2018 64 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. @Override
  2. protected void onListItemClick(ListView l, View v, int position, long id) {
  3.     super.onListItemClick(l, v, position, id);
  4.     Object o = this.getListAdapter().getItem(position);
  5.     keyword = o.toString();
  6.     positions = position;
  7.  
  8.     if(position != 0 ){
  9.         Bundle bundle = new Bundle();
  10.  
  11.         Intent showContent = new Intent(getApplicationContext(),SalesRouteDevitionActivity.class);
  12.         int postion = position;
  13.         String aString = Integer.toString(postion);
  14.         bundle.putString("positon", aString);
  15.         showContent.putExtras(bundle);
  16.         startActivityForResult(showContent,0);
  17.     }else{
  18.  
  19.         Intent intent = new Intent(SalesRouteActivity.this, ListRetailerActivity.class);
  20.         Bundle bundle = new Bundle();
  21.         bundle.putString("RouteName", keyword);
  22.         intent.putExtras(bundle);
  23.         View view = SalesActivityGroup.group.getLocalActivityManager().startActivity("", intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)).getDecorView();  
  24.         SalesActivityGroup.group.replaceView(view);
  25.     }
  26. }
  27.  
  28.  
  29.    @Override
  30.   protected void onActivityResult(int requestCode, int resultCode, Intent data) {  
  31.  
  32.        Log.w("onActivityResult" ," --requestCode ---" + requestCode + " -- resultCode -- " + resultCode + " -- data --" + data);
  33.       if(resultCode==0){
  34.           Toast.makeText(this, "Reason has been successfully.", Toast.LENGTH_LONG).show();
  35.           if(resultCode==RESULT_OK)
  36.               Toast.makeText(this, "Reason has been successfully.", Toast.LENGTH_LONG).show();
  37.          else
  38.               Toast.makeText(this, "Fail", Toast.LENGTH_LONG).show();
  39.       }
  40.   }
  41.    
  42. public class SalesRouteDevitionActivity extends Activity {
  43. private String array_spinner[];
  44. String param1 = "";
  45. @Override
  46. public void onCreate(Bundle savedInstanceState) {
  47.     super.onCreate(savedInstanceState);
  48.     setContentView(R.layout.route_diviation_popup);
  49.     array_spinner=new String[2];
  50.     array_spinner[0]="Rain";
  51.     array_spinner[1]="Floods";
  52.  
  53.     Spinner s = (Spinner) findViewById(R.id.spinner1);
  54.     ArrayAdapter adapter = new ArrayAdapter(this, android.R.layout.simple_spinner_dropdown_item, array_spinner);
  55.     s.setAdapter(adapter);
  56.     Button button = (Button) findViewById(R.id.submit);
  57.  
  58.      button.setOnClickListener(new OnClickListener() {
  59.          public void onClick(View v) {
  60.  
  61.  
  62.              Intent mIntent = new Intent();
  63.              setResult(RESULT_OK);
  64.              finish();
  65.  
  66.  
  67.  
  68.          }
  69.      });
  70.  
  71. }
  72.  
  73. }
  74.    
  75. public class MainActivity extends TabActivity {
  76. int selectedTab;
  77. TabHost tabHost ;
  78.  
  79. public void onCreate(Bundle savedInstanceState) {
  80.     super.onCreate(savedInstanceState);
  81.     setContentView(R.layout.tabview);
  82.  
  83.     TabHost t = getTabHost();
  84.     tabHost = (TabHost)findViewById(android.R.id.tabhost);
  85.  
  86.     TabSpec firstTabSpec = tabHost.newTabSpec("tid1");
  87.     TabSpec secondTabSpec = tabHost.newTabSpec("tid1");
  88.     TabSpec thirdTabSpec = tabHost.newTabSpec("tid1");
  89.     /** TabSpec setIndicator() is used to set name for the tab. */
  90.     /** TabSpec setContent() is used to set content for a particular tab. */
  91.     firstTabSpec.setIndicator("Sales").setContent(new Intent(this,SalesActivityGroup.class));
  92.     secondTabSpec.setIndicator("Admin").setContent(new Intent(this,SettingActivityGroup.class));
  93.     thirdTabSpec.setIndicator("Setting").setContent(new Intent(this,SettingActivityGroup.class));
  94.  
  95.  
  96.     tabHost.addTab(firstTabSpec);
  97.     tabHost.addTab(secondTabSpec);
  98.     tabHost.addTab(thirdTabSpec);
  99.     tabHost.setCurrentTab(0);
  100.     tabHost.setMinimumHeight(25);
  101. }
  102.  
  103. public void onTabChanged(String arg0) {
  104.         selectedTab = tabHost.getCurrentTab();
  105.  
  106. }
  107.    
  108. public class SalesActivityGroup extends ActivityGroup {
  109.  
  110. public static SalesActivityGroup group;
  111. private ArrayList<View> history;
  112.  
  113. @Override
  114. protected void onCreate(Bundle savedInstanceState) {
  115.     super.onCreate(savedInstanceState);
  116.     this.history = new ArrayList<View>();
  117.     group = this;
  118.  
  119.     View view = getLocalActivityManager().startActivity("Sales",
  120.             new Intent(this, SalesRouteActivity.class).addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP))
  121.             .getDecorView();
  122.  
  123.     replaceView(view);
  124.  
  125. }
  126.  
  127. public void replaceView(View v) {
  128.     history.add(v);
  129.     setContentView(v);
  130.  
  131. }
  132.  
  133. public void back() {
  134.     if (history.size() > 0) {
  135.         history.remove(history.size() - 1);
  136.         if (history.size() > 0) {
  137.             setContentView(history.get(history.size() - 1));
  138.         } else {
  139.             finish();
  140.         }
  141.     } else {
  142.         finish();
  143.     }
  144. }
  145.  
  146. @Override
  147. public void onBackPressed() {
  148.     SalesActivityGroup.group.back();
  149.     return;
  150. }
  151.    
  152. Intent resultIntent = new Intent();
  153. setResult(Activity.RESULT_OK, resultIntent);
  154. finish();
  155.    
  156. super.onActivityResult(requestCode, resultCode, data);
  157.    
  158. if(resultCode==0)
  159.    
  160. if(requestCode==0)
  161.    
  162. Intent showContent = new Intent(botton.getContext(),RetailerOrderEActivity.class);
  163.  getParent().startActivityForResult(showContent, 2);
  164.    
  165. Intent i = new Intent();
  166.     Bundle bundle = new Bundle();
  167.     i.putExtras(bundle);
  168.     setResult(Activity.RESULT_OK, i);
  169.     finish();
  170.    
  171. protected void onActivityResult(int requestCode, int resultCode, Intent data) {
  172.  
  173.     if(requestCode ==1){
  174.         Bundle bundle = data.getExtras();
  175.         String roteCode = bundle.getString("RouteCode");
  176.         Intent intent = new Intent(SalesActivityGroup.this,ListRetailerActivity.class);
  177.         bundle.putString("RouteCode", roteCode);
  178.         intent.putExtras(bundle);
  179.         View view = SalesActivityGroup.group.getLocalActivityManager().startActivity("",intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)).getDecorView();
  180.         SalesActivityGroup.group.replaceView(view);
  181.     }
  182.    }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top